style: 格式化代码
This commit is contained in:
@@ -50,13 +50,13 @@ async def _calculate_interest(message: MessageRecv) -> Tuple[float, bool]:
|
||||
query_text=message.processed_plain_text,
|
||||
user_id=str(message.user_info.user_id),
|
||||
scope_id=message.chat_id,
|
||||
limit=5
|
||||
limit=5,
|
||||
)
|
||||
|
||||
# 基于检索结果计算兴趣度
|
||||
if enhanced_memories:
|
||||
# 有相关记忆,兴趣度基于相似度计算
|
||||
max_score = max(getattr(memory, 'relevance_score', 0.5) for memory in enhanced_memories)
|
||||
max_score = max(getattr(memory, "relevance_score", 0.5) for memory in enhanced_memories)
|
||||
interested_rate = min(max_score, 1.0) # 限制在0-1之间
|
||||
else:
|
||||
# 没有相关记忆,给予基础兴趣度
|
||||
|
||||
@@ -4,6 +4,7 @@ from src.chat.utils.prompt import Prompt, global_prompt_manager
|
||||
from src.chat.utils.chat_message_builder import build_readable_messages, get_raw_msg_before_timestamp_with_chat
|
||||
import time
|
||||
from src.chat.utils.utils import get_recent_group_speaker
|
||||
|
||||
# 旧的Hippocampus系统已被移除,现在使用增强记忆系统
|
||||
# from src.chat.memory_system.enhanced_memory_manager import enhanced_memory_manager
|
||||
import random
|
||||
@@ -181,14 +182,16 @@ class PromptBuilder:
|
||||
query_text=text,
|
||||
user_id="system", # 系统查询
|
||||
scope_id="system",
|
||||
limit=5
|
||||
limit=5,
|
||||
)
|
||||
|
||||
related_memory_info = ""
|
||||
if enhanced_memories:
|
||||
for memory_chunk in enhanced_memories:
|
||||
related_memory_info += memory_chunk.display or memory_chunk.text_content or ""
|
||||
return await global_prompt_manager.format_prompt("memory_prompt", memory_info=related_memory_info.strip())
|
||||
return await global_prompt_manager.format_prompt(
|
||||
"memory_prompt", memory_info=related_memory_info.strip()
|
||||
)
|
||||
return ""
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user