refactor: 延迟导入 StreamContext 以提高类型检查性能
This commit is contained in:
@@ -144,7 +144,7 @@ class ChatterPlanFilter:
|
||||
plan.decided_actions = [
|
||||
ActionPlannerInfo(action_type="no_action", reasoning=f"筛选时出错: {e}")
|
||||
]
|
||||
|
||||
|
||||
# 在返回最终计划前,打印将要执行的动作
|
||||
if plan.decided_actions:
|
||||
action_types = [action.action_type for action in plan.decided_actions]
|
||||
@@ -543,12 +543,6 @@ class ChatterPlanFilter:
|
||||
f"[{action}] 找不到目标消息,target_message_id: {action_data.get('target_message_id')}"
|
||||
)
|
||||
|
||||
# 从action_data中提取should_quote_reply参数
|
||||
should_quote_reply = action_data.get("should_quote_reply")
|
||||
# 严格按照标准格式,只接受布尔值
|
||||
if not isinstance(should_quote_reply, bool):
|
||||
should_quote_reply = None
|
||||
|
||||
return ActionPlannerInfo(
|
||||
action_type=action,
|
||||
reasoning=reasoning,
|
||||
|
||||
@@ -200,6 +200,15 @@ class ChatterActionPlanner:
|
||||
available_actions = list(initial_plan.available_actions.keys())
|
||||
plan_filter = ChatterPlanFilter(self.chat_id, available_actions)
|
||||
filtered_plan = await plan_filter.filter(initial_plan)
|
||||
|
||||
# 检查reply动作是否可用
|
||||
reply_action_available = "reply" in available_actions or "respond" in available_actions
|
||||
if filtered_plan.decided_actions and not reply_action_available:
|
||||
logger.info("Focus模式 - 回复动作不可用,移除所有回复相关动作")
|
||||
filtered_plan.decided_actions = [
|
||||
action for action in filtered_plan.decided_actions
|
||||
if action.action_type not in ["reply", "respond"]
|
||||
]
|
||||
|
||||
# 7. 检查是否正在处理相同的目标消息,防止重复回复
|
||||
target_message_id = None
|
||||
|
||||
Reference in New Issue
Block a user