From 1e71105e62dfbf3b17a6ca9ee8ac70d948dcf58c Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Thu, 21 Aug 2025 15:12:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(chat):=20=E5=A4=84=E7=90=86=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=97=B6=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8target=5F?= =?UTF-8?q?message=E9=81=BF=E5=85=8D=E6=B6=88=E6=81=AF=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在循环处理器中,当ActionPlanner返回了明确要回复的目标消息时使用target_message,否则回退到原始message_data; 修正FOCUS模式下观察消息时调用observe的实参缺失问题,确保逐条处理recent_messages。 --- src/chat/chat_loop/cycle_processor.py | 4 +++- src/chat/chat_loop/heartFC_chat.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chat/chat_loop/cycle_processor.py b/src/chat/chat_loop/cycle_processor.py index f67f7808c..e925df8d0 100644 --- a/src/chat/chat_loop/cycle_processor.py +++ b/src/chat/chat_loop/cycle_processor.py @@ -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( diff --git a/src/chat/chat_loop/heartFC_chat.py b/src/chat/chat_loop/heartFC_chat.py index cd6392bdc..0f6a4d554 100644 --- a/src/chat/chat_loop/heartFC_chat.py +++ b/src/chat/chat_loop/heartFC_chat.py @@ -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))