feat(chat): 优化记忆检索逻辑,异步调用增强记忆系统
This commit is contained in:
@@ -488,6 +488,13 @@ class DefaultReplyer:
|
|||||||
try:
|
try:
|
||||||
# 使用新的增强记忆系统
|
# 使用新的增强记忆系统
|
||||||
from src.chat.memory_system.enhanced_memory_integration import recall_memories, remember_message
|
from src.chat.memory_system.enhanced_memory_integration import recall_memories, remember_message
|
||||||
|
|
||||||
|
# 检索相关记忆
|
||||||
|
enhanced_memories = await recall_memories(
|
||||||
|
query=target,
|
||||||
|
user_id=str(self.chat_stream.stream_id),
|
||||||
|
chat_id=self.chat_stream.stream_id
|
||||||
|
)
|
||||||
|
|
||||||
# 异步存储聊天历史(非阻塞)
|
# 异步存储聊天历史(非阻塞)
|
||||||
asyncio.create_task(
|
asyncio.create_task(
|
||||||
@@ -497,12 +504,6 @@ class DefaultReplyer:
|
|||||||
chat_id=self.chat_stream.stream_id
|
chat_id=self.chat_stream.stream_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# 检索相关记忆
|
|
||||||
enhanced_memories = await recall_memories(
|
|
||||||
query=target,
|
|
||||||
user_id=str(self.chat_stream.stream_id),
|
|
||||||
chat_id=self.chat_stream.stream_id
|
|
||||||
)
|
|
||||||
|
|
||||||
# 转换格式以兼容现有代码
|
# 转换格式以兼容现有代码
|
||||||
running_memories = []
|
running_memories = []
|
||||||
|
|||||||
Reference in New Issue
Block a user