fix:无动作时卡入no_reply

This commit is contained in:
SengokuCola
2025-07-13 00:04:57 +08:00
parent 58ef00865d
commit 16c2a8b68e
5 changed files with 221 additions and 26 deletions

View File

@@ -103,15 +103,13 @@ class ActionPlanner:
logger.warning(f"{self.log_prefix}使用中的动作 {action_name} 未在已注册动作中找到")
# 如果没有可用动作或只有no_reply动作直接返回no_reply
if not current_available_actions or (
len(current_available_actions) == 1 and "no_reply" in current_available_actions
):
action = "no_reply"
reasoning = "没有可用的动作" if not current_available_actions else "只有no_reply动作可用跳过规划"
if not current_available_actions:
if mode == "focus":
action = "no_reply"
else:
action = "no_action"
reasoning = "没有可用的动作"
logger.info(f"{self.log_prefix}{reasoning}")
logger.debug(
f"{self.log_prefix}[focus]沉默后恢复到默认动作集, 当前可用: {list(self.action_manager.get_using_actions().keys())}"
)
return {
"action_result": {"action_type": action, "action_data": action_data, "reasoning": reasoning},
}