From 2db8720498cfc14bbfaecc36e89597e9a6c6bcca Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Wed, 13 Aug 2025 18:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=B3=E7=AD=96=E5=90=8E?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=96=B0=E6=B6=88=E6=81=AF=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=9A=84=E5=87=86=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/planner_actions/planner.py | 40 ++++++++++++----------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/chat/planner_actions/planner.py b/src/chat/planner_actions/planner.py index e3a1d5eb1..88e5a6361 100644 --- a/src/chat/planner_actions/planner.py +++ b/src/chat/planner_actions/planner.py @@ -274,21 +274,20 @@ class ActionPlanner: actions.append({ "action_type": action, "reasoning": reasoning, - "action_data": action_data, - "action_message": target_message, - "available_actions": available_actions # 添加这个字段 - }) - - if action != "reply" and is_parallel: - actions.append({ - "action_type": "reply", - "action_message": target_message, - "available_actions": available_actions - }) - - return actions,target_message - - + "timestamp": time.time(), + "is_parallel": is_parallel, + } + + # 只有在成功完成决策后才更新已读时间戳,确保新消息判断的准确性 + self.last_obs_time_mark = time.time() + + return ( + { + "action_result": action_result, + "action_prompt": prompt, + }, + target_message, + ) async def build_planner_prompt( self, @@ -326,15 +325,8 @@ class ActionPlanner: ) actions_before_now_block = f"你刚刚选择并执行过的action是:\n{actions_before_now_block}" - if refresh_time: - self.last_obs_time_mark = time.time() - - mentioned_bonus = "" - if global_config.chat.mentioned_bot_inevitable_reply: - mentioned_bonus = "\n- 有人提到你" - if global_config.chat.at_bot_inevitable_reply: - mentioned_bonus = "\n- 有人提到你,或者at你" - + + # 注意:不在这里更新last_obs_time_mark,应该在plan成功后再更新,避免异常情况下错误更新时间戳 if mode == ChatMode.FOCUS: no_action_block = """