feat(affinity-flow): 增强关系追踪系统的人设集成和逻辑严谨性
- 在关系追踪器中集成bot人设信息,从性格视角分析用户互动 - 添加严格的关系分数档次定义和现实发展逻辑约束 - 改进提示词工程,要求详细的性格观察和互动记忆记录 - 单次互动加分限制在合理范围内(0.05-0.1),防止跳跃式关系提升 - 优化关系印象描述要求(100-200字),包含用户性格特点和深刻记忆 refactor(planner): 简化消息数据处理流程 - 使用StreamContext对象替代原始的message_data字典 - 移除冗余的消息数据准备步骤,直接从context获取未读消息 - 统一规划器接口,提高代码可读性和维护性 fix(person-info): 添加napcat到qq平台的用户ID迁移机制 - 为qq平台生成person_id时检查是否存在napcat平台的相同用户 - 如果存在则自动迁移记录并更新平台信息 - 确保用户身份在不同平台间的正确识别和延续 fix(plan-executor): 修复自我回复检测逻辑 - 使用action_message.user_info.user_id替代原始字典访问 - 防止因消息格式变化导致的自我回复检测失效 chore(config): 更新默认平台配置为qq - 将napcat_adapter插件的默认平台名称从napcat改为qq - 保持与现有部署环境的一致性
This commit is contained in:
@@ -9,6 +9,7 @@ from typing import Dict
|
||||
|
||||
from src.chat.planner_actions.action_manager import ActionManager
|
||||
from src.chat.planner_actions.planner import ActionPlanner
|
||||
from src.common.data_models.message_manager_data_model import StreamContext
|
||||
from src.plugin_system.base.component_types import ChatMode
|
||||
|
||||
from src.common.logger import get_logger
|
||||
@@ -42,7 +43,7 @@ class AffinityFlowChatter:
|
||||
}
|
||||
self.last_activity_time = time.time()
|
||||
|
||||
async def process_stream_context(self, context) -> Dict[str, any]:
|
||||
async def process_stream_context(self, context: StreamContext) -> Dict[str, any]:
|
||||
"""
|
||||
处理StreamContext对象
|
||||
|
||||
@@ -53,27 +54,18 @@ class AffinityFlowChatter:
|
||||
处理结果字典
|
||||
"""
|
||||
try:
|
||||
# 获取未读消息和历史消息
|
||||
unread_messages = context.get_unread_messages()
|
||||
history_messages = context.get_history_messages()
|
||||
|
||||
# 准备消息数据
|
||||
message_data = {
|
||||
"unread_messages": unread_messages,
|
||||
"history_messages": history_messages
|
||||
}
|
||||
|
||||
# 使用增强版规划器处理消息
|
||||
actions, target_message = await self.planner.plan(
|
||||
mode=ChatMode.FOCUS,
|
||||
message_data=message_data
|
||||
context=context
|
||||
)
|
||||
self.stats["plans_created"] += 1
|
||||
|
||||
# 执行动作(如果规划器返回了动作)
|
||||
execution_result = {"executed_count": len(actions) if actions else 0}
|
||||
if actions:
|
||||
# 这里可以添加额外的动作执行逻辑
|
||||
logger.debug(f"聊天流 {self.stream_id} 生成了 {len(actions)} 个动作")
|
||||
|
||||
# 更新统计
|
||||
|
||||
Reference in New Issue
Block a user