ruff
This commit is contained in:
@@ -279,11 +279,16 @@ class ActionPlanner:
|
|||||||
action_time = action_data.get("time", "")
|
action_time = action_data.get("time", "")
|
||||||
elif isinstance(action_data, tuple):
|
elif isinstance(action_data, tuple):
|
||||||
# 假设旧格式兼容
|
# 假设旧格式兼容
|
||||||
if len(action_data) > 0: action_type = action_data[0]
|
if len(action_data) > 0:
|
||||||
if len(action_data) > 1: plan_reason = action_data[1] # 可能是规划原因或最终原因
|
action_type = action_data[0]
|
||||||
if len(action_data) > 2: status = action_data[2]
|
if len(action_data) > 1:
|
||||||
if status == "recall" and len(action_data) > 3: final_reason = action_data[3]
|
plan_reason = action_data[1] # 可能是规划原因或最终原因
|
||||||
elif status == "done" and action_type in ["direct_reply", "send_new_message"]: plan_reason = "成功发送" # 简化显示
|
if len(action_data) > 2:
|
||||||
|
status = action_data[2]
|
||||||
|
if status == "recall" and len(action_data) > 3:
|
||||||
|
final_reason = action_data[3]
|
||||||
|
elif status == "done" and action_type in ["direct_reply", "send_new_message"]:
|
||||||
|
plan_reason = "成功发送" # 简化显示
|
||||||
|
|
||||||
reason_text = f", 失败/取消原因: {final_reason}" if final_reason else ""
|
reason_text = f", 失败/取消原因: {final_reason}" if final_reason else ""
|
||||||
summary_line = f"- 时间:{action_time}, 尝试行动:'{action_type}', 状态:{status}{reason_text}"
|
summary_line = f"- 时间:{action_time}, 尝试行动:'{action_type}', 状态:{status}{reason_text}"
|
||||||
@@ -310,7 +315,7 @@ class ActionPlanner:
|
|||||||
# --- 选择 Prompt ---
|
# --- 选择 Prompt ---
|
||||||
if last_successful_reply_action in ['direct_reply', 'send_new_message']:
|
if last_successful_reply_action in ['direct_reply', 'send_new_message']:
|
||||||
prompt_template = PROMPT_FOLLOW_UP
|
prompt_template = PROMPT_FOLLOW_UP
|
||||||
logger.debug(f"使用 PROMPT_FOLLOW_UP (追问决策)")
|
logger.debug("使用 PROMPT_FOLLOW_UP (追问决策)")
|
||||||
else:
|
else:
|
||||||
prompt_template = PROMPT_INITIAL_REPLY
|
prompt_template = PROMPT_INITIAL_REPLY
|
||||||
logger.debug("使用 PROMPT_INITIAL_REPLY (首次/非连续回复决策)")
|
logger.debug("使用 PROMPT_INITIAL_REPLY (首次/非连续回复决策)")
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ class Conversation:
|
|||||||
if not hasattr(self, 'waiter'):
|
if not hasattr(self, 'waiter'):
|
||||||
logger.error("Waiter 未初始化,无法等待。")
|
logger.error("Waiter 未初始化,无法等待。")
|
||||||
raise AttributeError("Waiter not initialized")
|
raise AttributeError("Waiter not initialized")
|
||||||
timeout_occurred = await self.waiter.wait(self.conversation_info)
|
_timeout_occurred = await self.waiter.wait(self.conversation_info)
|
||||||
action_successful = True # Wait 完成就算成功
|
action_successful = True # Wait 完成就算成功
|
||||||
except Exception as wait_err:
|
except Exception as wait_err:
|
||||||
logger.error(f"等待时出错: {wait_err}")
|
logger.error(f"等待时出错: {wait_err}")
|
||||||
|
|||||||
Reference in New Issue
Block a user