fix(chat): 处理回复时优先使用target_message避免消息丢失

在循环处理器中,当ActionPlanner返回了明确要回复的目标消息时使用target_message,否则回退到原始message_data;
修正FOCUS模式下观察消息时调用observe的实参缺失问题,确保逐条处理recent_messages。
This commit is contained in:
minecraft1024a
2025-08-21 15:12:41 +08:00
parent 4c51f59c96
commit 785b3d2f2a
2 changed files with 5 additions and 2 deletions

View File

@@ -114,8 +114,10 @@ class CycleProcessor:
action_type = "reply"
if action_type == "reply":
# 使用 action_planner 获取的 target_message如果为空则使用原始 message_data
actual_message = target_message or message_data
await self._handle_reply_action(
message_data, available_actions, gen_task, loop_start_time, cycle_timers, thinking_id, plan_result
actual_message, available_actions, gen_task, loop_start_time, cycle_timers, thinking_id, plan_result
)
else:
await self._handle_other_actions(

View File

@@ -195,7 +195,8 @@ class HeartFChatting:
if self.context.loop_mode == ChatMode.FOCUS:
if recent_messages:
await self.cycle_processor.observe()
for message in recent_messages:
await self.cycle_processor.observe(message)
self._check_focus_exit()
elif self.context.loop_mode == ChatMode.NORMAL:
self._check_focus_entry(len(recent_messages))