better:优化统计和心流提示词
This commit is contained in:
@@ -83,7 +83,7 @@ class PromptBuilder:
|
||||
text=message_txt,
|
||||
max_memory_num=3,
|
||||
max_memory_length=2,
|
||||
max_depth=3,
|
||||
max_depth=4,
|
||||
fast_retrieval=False
|
||||
)
|
||||
memory_str = ""
|
||||
|
||||
@@ -1046,14 +1046,14 @@ class Hippocampus:
|
||||
# 将选中的节点添加到remember_map
|
||||
for node, normalized_activation in sorted_nodes:
|
||||
remember_map[node] = activate_map[node] # 使用原始激活值
|
||||
logger.info(
|
||||
logger.debug(
|
||||
f"节点 '{node}' (归一化激活值: {normalized_activation:.2f}, 激活值: {activate_map[node]:.2f})")
|
||||
else:
|
||||
logger.info("没有有效的激活值")
|
||||
|
||||
# 从选中的节点中提取记忆
|
||||
all_memories = []
|
||||
logger.info("开始从选中的节点中提取记忆:")
|
||||
# logger.info("开始从选中的节点中提取记忆:")
|
||||
for node, activation in remember_map.items():
|
||||
logger.debug(f"处理节点 '{node}' (激活值: {activation:.2f}):")
|
||||
node_data = self.memory_graph.G.nodes[node]
|
||||
|
||||
@@ -44,13 +44,19 @@ class LLMStatistics:
|
||||
|
||||
def _record_online_time(self):
|
||||
"""记录在线时间"""
|
||||
try:
|
||||
current_time = datetime.now()
|
||||
# 检查5分钟内是否已有记录
|
||||
recent_record = db.online_time.find_one({
|
||||
"timestamp": {
|
||||
"$gte": current_time - timedelta(minutes=5)
|
||||
}
|
||||
})
|
||||
|
||||
if not recent_record:
|
||||
db.online_time.insert_one({
|
||||
"timestamp": datetime.now(),
|
||||
"timestamp": current_time,
|
||||
"duration": 5 # 5分钟
|
||||
})
|
||||
except Exception:
|
||||
logger.exception("记录在线时间失败")
|
||||
|
||||
def _collect_statistics_for_period(self, start_time: datetime) -> Dict[str, Any]:
|
||||
"""收集指定时间段的LLM请求统计数据
|
||||
|
||||
Reference in New Issue
Block a user