fix(chat): 将 proactive_reply 动作添加到豁免列表
主动回复(proactive_reply)动作不针对特定消息,也不属于需要验证的可用工具。 此更改将其添加到 planner 的逻辑检查豁免中,以防止因缺少 `target_message_id` 或不在可用动作列表中而被错误地判定为无效。
This commit is contained in:
@@ -319,7 +319,7 @@ class ActionPlanner:
|
|||||||
action_data = {k: v for k, v in action_json.items() if k not in ["action", "reason"]}
|
action_data = {k: v for k, v in action_json.items() if k not in ["action", "reason"]}
|
||||||
|
|
||||||
target_message = None
|
target_message = None
|
||||||
if action not in ["no_action", "no_reply", "do_nothing"]:
|
if action not in ["no_action", "no_reply", "do_nothing", "proactive_reply"]:
|
||||||
if target_message_id := action_json.get("target_message_id"):
|
if target_message_id := action_json.get("target_message_id"):
|
||||||
target_message = self.find_message_by_id(target_message_id, message_id_list)
|
target_message = self.find_message_by_id(target_message_id, message_id_list)
|
||||||
if target_message is None:
|
if target_message is None:
|
||||||
@@ -329,7 +329,7 @@ class ActionPlanner:
|
|||||||
logger.warning(f"{self.log_prefix}动作'{action}'缺少target_message_id")
|
logger.warning(f"{self.log_prefix}动作'{action}'缺少target_message_id")
|
||||||
|
|
||||||
available_action_names = [name for name, _ in current_available_actions]
|
available_action_names = [name for name, _ in current_available_actions]
|
||||||
if action not in ["no_action", "no_reply", "reply", "do_nothing"] and action not in available_action_names:
|
if action not in ["no_action", "no_reply", "reply", "do_nothing", "proactive_reply"] and action not in available_action_names:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"{self.log_prefix}LLM 返回了当前不可用或无效的动作: '{action}' (可用: {available_action_names}),将强制使用 'no_action'"
|
f"{self.log_prefix}LLM 返回了当前不可用或无效的动作: '{action}' (可用: {available_action_names}),将强制使用 'no_action'"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user