优化ActionPlanner类中的时间戳更新逻辑,确保在成功执行计划后再更新last_obs_time_mark,以提高消息判断的准确性。

This commit is contained in:
minecraft1024a
2025-08-14 17:57:01 +08:00
committed by Windpicker-owo
parent 1ed7d1248d
commit 8a68a6b641

View File

@@ -266,8 +266,6 @@ class ActionPlanner:
"is_parallel": is_parallel, "is_parallel": is_parallel,
} }
# 只有在成功完成决策后才更新已读时间戳,确保新消息判断的准确性
self.last_obs_time_mark = time.time()
return ( return (
{ {
@@ -318,6 +316,8 @@ class ActionPlanner:
actions_before_now_block = f"你刚刚选择并执行过的action是\n{actions_before_now_block}" actions_before_now_block = f"你刚刚选择并执行过的action是\n{actions_before_now_block}"
# 注意不在这里更新last_obs_time_mark应该在plan成功后再更新避免异常情况下错误更新时间戳 # 注意不在这里更新last_obs_time_mark应该在plan成功后再更新避免异常情况下错误更新时间戳
self.last_obs_time_mark = time.time()
if mode == ChatMode.FOCUS: if mode == ChatMode.FOCUS:
no_action_block = """ no_action_block = """