fix(chat): 处理回复时优先使用target_message避免消息丢失
在循环处理器中,当ActionPlanner返回了明确要回复的目标消息时使用target_message,否则回退到原始message_data; 修正FOCUS模式下观察消息时调用observe的实参缺失问题,确保逐条处理recent_messages。
This commit is contained in:
committed by
Windpicker-owo
parent
1238ee3089
commit
1e71105e62
@@ -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(
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user