优化决策后时间戳更新逻辑,确保新消息判断的准确性
This commit is contained in:
committed by
Windpicker-owo
parent
0053daffd9
commit
2db8720498
@@ -274,21 +274,20 @@ class ActionPlanner:
|
|||||||
actions.append({
|
actions.append({
|
||||||
"action_type": action,
|
"action_type": action,
|
||||||
"reasoning": reasoning,
|
"reasoning": reasoning,
|
||||||
"action_data": action_data,
|
"timestamp": time.time(),
|
||||||
"action_message": target_message,
|
"is_parallel": is_parallel,
|
||||||
"available_actions": available_actions # 添加这个字段
|
}
|
||||||
})
|
|
||||||
|
# 只有在成功完成决策后才更新已读时间戳,确保新消息判断的准确性
|
||||||
if action != "reply" and is_parallel:
|
self.last_obs_time_mark = time.time()
|
||||||
actions.append({
|
|
||||||
"action_type": "reply",
|
return (
|
||||||
"action_message": target_message,
|
{
|
||||||
"available_actions": available_actions
|
"action_result": action_result,
|
||||||
})
|
"action_prompt": prompt,
|
||||||
|
},
|
||||||
return actions,target_message
|
target_message,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def build_planner_prompt(
|
async def build_planner_prompt(
|
||||||
self,
|
self,
|
||||||
@@ -326,15 +325,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}"
|
||||||
if refresh_time:
|
|
||||||
self.last_obs_time_mark = time.time()
|
# 注意:不在这里更新last_obs_time_mark,应该在plan成功后再更新,避免异常情况下错误更新时间戳
|
||||||
|
|
||||||
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你"
|
|
||||||
|
|
||||||
|
|
||||||
if mode == ChatMode.FOCUS:
|
if mode == ChatMode.FOCUS:
|
||||||
no_action_block = """
|
no_action_block = """
|
||||||
|
|||||||
Reference in New Issue
Block a user