feat(affinity-flow): 实现回复后关系追踪系统集成

- 在relationship_tracker.py中添加数据库支持的回复后关系追踪功能
- 新增UserRelationships数据库模型存储用户关系数据
- 集成全局关系追踪器到planner和interest_scoring系统
- 优化兴趣度评分系统的关系分获取逻辑,优先使用数据库存储的关系分
- 在plan_executor中执行回复后关系追踪,分析用户反应并更新关系
- 添加LLM响应清理功能确保JSON解析稳定性
- 更新模型配置模板添加relationship_tracker模型配置
This commit is contained in:
Windpicker-owo
2025-09-19 11:28:37 +08:00
parent a2225cad3a
commit 812e4d76f8
12 changed files with 715 additions and 116 deletions

View File

@@ -296,8 +296,13 @@ class SendHandler:
return reply_seg
try:
# 尝试通过 message_id 获取消息详情
msg_info_response = await self.send_message_to_napcat("get_msg", {"message_id": int(id)})
# 检查是否为缓冲消息ID格式buffered-{original_id}-{timestamp}
if id.startswith('buffered-'):
# 从缓冲消息ID中提取原始消息ID
original_id = id.split('-')[1]
msg_info_response = await self.send_message_to_napcat("get_msg", {"message_id": int(original_id)})
else:
msg_info_response = await self.send_message_to_napcat("get_msg", {"message_id": int(id)})
replied_user_id = None
if msg_info_response and msg_info_response.get("status") == "ok":