尝试减少不同群内的同义词混淆 以及允许用户设置指定群组记忆私有
用户设置指定群组记忆私有会导致记忆的语料严重减少 未设置群组记忆私有的记忆会开放对于所有群聊 因此要不就修改其他记忆配置 增强学习/记忆能力 或者增加单一群组的信息流数量 或者增加公开记忆的信息流数量 记忆检索时会按以下优先级返回记忆: 当前群组的记忆(如果群聊属于某个群组) 当前群聊的记忆(如果不属于任何群组) 公共记忆(无群组/群聊标识的记忆) 其他非私有群组的记忆 5. 跨群记忆连接 同一群组内的主题使用较强连接(相似度×10) 跨群组的相似主题使用较弱连接(相似度×5) 相同群组/群聊的相似主题会获得20%的相似度加成
This commit is contained in:
@@ -91,12 +91,20 @@ class PromptBuilder:
|
||||
memory_prompt = ''
|
||||
start_time = time.time()
|
||||
|
||||
# 获取群组ID
|
||||
group_id = None
|
||||
if stream_id:
|
||||
chat_stream = chat_manager.get_stream(stream_id)
|
||||
if chat_stream and chat_stream.group_info:
|
||||
group_id = chat_stream.group_info.group_id
|
||||
|
||||
# 调用 hippocampus 的 get_relevant_memories 方法
|
||||
relevant_memories = await hippocampus.get_relevant_memories(
|
||||
text=message_txt,
|
||||
max_topics=5,
|
||||
similarity_threshold=0.4,
|
||||
max_memory_num=5
|
||||
max_memory_num=5,
|
||||
group_id=group_id # 传递群组ID
|
||||
)
|
||||
|
||||
if relevant_memories:
|
||||
|
||||
Reference in New Issue
Block a user