better:优化记忆提取功能
This commit is contained in:
@@ -96,7 +96,7 @@ class Heartflow:
|
||||
continue
|
||||
|
||||
await self.do_a_thinking()
|
||||
await asyncio.sleep(global_config.heart_flow_update_interval) # 5分钟思考一次
|
||||
await asyncio.sleep(global_config.heart_flow_update_interval * 3) # 5分钟思考一次
|
||||
|
||||
async def heartflow_start_working(self):
|
||||
# 启动清理任务
|
||||
@@ -110,7 +110,7 @@ class Heartflow:
|
||||
print("TODO")
|
||||
|
||||
async def do_a_thinking(self):
|
||||
logger.debug("麦麦大脑袋转起来了")
|
||||
# logger.debug("麦麦大脑袋转起来了")
|
||||
self.current_state.update_current_state_info()
|
||||
|
||||
# 开始构建prompt
|
||||
|
||||
@@ -139,7 +139,7 @@ class ChattingObservation(Observation):
|
||||
# traceback.print_exc() # 记录详细堆栈
|
||||
# print(f"处理后self.talking_message:{self.talking_message}")
|
||||
|
||||
self.talking_message_str = await build_readable_messages(self.talking_message)
|
||||
self.talking_message_str = await build_readable_messages(messages=self.talking_message, timestamp_mode="normal")
|
||||
|
||||
logger.trace(
|
||||
f"Chat {self.chat_id} - 压缩早期记忆:{self.mid_memory_info}\n现在聊天内容:{self.talking_message_str}"
|
||||
|
||||
@@ -220,9 +220,8 @@ class MessageManager:
|
||||
await asyncio.sleep(typing_time)
|
||||
logger.debug(f"\n{message_earliest.processed_plain_text},{typing_time},等待输入时间结束\n")
|
||||
|
||||
await self.storage.store_message(message_earliest, message_earliest.chat_stream)
|
||||
|
||||
await MessageSender().send_message(message_earliest)
|
||||
await self.storage.store_message(message_earliest, message_earliest.chat_stream)
|
||||
|
||||
container.remove_message(message_earliest)
|
||||
|
||||
|
||||
@@ -1946,15 +1946,14 @@ class HippocampusManager:
|
||||
valid_keywords: list[str],
|
||||
max_memory_num: int = 3,
|
||||
max_memory_length: int = 2,
|
||||
max_depth: int = 3,
|
||||
fast_retrieval: bool = False,
|
||||
max_depth: int = 3
|
||||
) -> list:
|
||||
"""从文本中获取相关记忆的公共接口"""
|
||||
if not self._initialized:
|
||||
raise RuntimeError("HippocampusManager 尚未初始化,请先调用 initialize 方法")
|
||||
try:
|
||||
response = await self._hippocampus.get_memory_from_topic(
|
||||
valid_keywords, max_memory_num, max_memory_length, max_depth, fast_retrieval
|
||||
valid_keywords, max_memory_num, max_memory_length, max_depth
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"文本激活记忆失败: {e}")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[inner]
|
||||
version = "1.3.1"
|
||||
version = "1.4.0"
|
||||
|
||||
|
||||
#以下是给开发人员阅读的,一般用户不需要阅读
|
||||
|
||||
Reference in New Issue
Block a user