feat(reply): 优化respond动作逻辑,移除不必要的目标消息参数

This commit is contained in:
Windpicker-owo
2025-11-10 16:07:23 +08:00
parent 00dec5c109
commit 861cc18e7d
2 changed files with 8 additions and 8 deletions

View File

@@ -1241,8 +1241,9 @@ class DefaultReplyer:
# 构建基础决策信息
action_descriptions = f"## 决策信息\n\n你已经决定要执行 **{action_name}** 动作({action_desc})。\n\n"
# 如果有目标消息信息,添加目标消息详情
if target_msg_info and isinstance(target_msg_info, dict):
# 只有需要目标消息的动作才显示目标消息详情
# respond 动作是统一回应所有未读消息,不应该显示特定目标消息
if action_name not in ["respond"] and target_msg_info and isinstance(target_msg_info, dict):
import time as time_module
sender = target_msg_info.get("sender", "未知用户")
content = target_msg_info.get("content", "")

View File

@@ -337,15 +337,13 @@ class ChatterActionPlanner:
from src.common.data_models.info_data_model import ActionPlannerInfo, Plan
from src.plugin_system.base.component_types import ChatType
# 构建目标消息字典 - 使用 flatten() 方法获取扁平化的字典
target_message_dict = target_message.flatten()
# Normal模式使用respond动作表示统一回应未读消息
# respond动作不需要target_message_id和action_message因为它是统一回应所有未读消息
respond_action = ActionPlannerInfo(
action_type="respond",
reasoning="Normal模式 - 兴趣度达到阈值使用respond动作统一回应未读消息",
action_data={"target_message_id": target_message.message_id},
action_message=target_message,
action_data={}, # respond动作不需要参数
action_message=None, # respond动作不针对特定消息
should_quote_reply=False, # Normal模式默认不引用回复保持对话流畅
)
@@ -375,7 +373,8 @@ class ChatterActionPlanner:
# 8. 检查是否需要退出Normal模式
await self._check_exit_normal_mode(context)
return [asdict(respond_action)], target_message_dict
# respond动作不返回目标消息因为它是统一回应所有未读消息
return [asdict(respond_action)], None
else:
# 未达到reply阈值
logger.debug("Normal模式 - 未达到reply阈值不执行回复")