ref:将识图改为实时,修复平行动作无法正常启用的问题

fix:平行动作无法正确执行
This commit is contained in:
SengokuCola
2025-08-24 15:56:57 +08:00
parent d10e08f15d
commit bc2b07302b
4 changed files with 41 additions and 16 deletions

View File

@@ -357,7 +357,7 @@ class ActionPlanner:
# --- 调用 LLM (普通文本生成) ---
llm_content = None
action_planner_infos = [] # 存储多个ActionPlannerInfo对象
action_planner_infos: List[ActionPlannerInfo] = [] # 存储多个ActionPlannerInfo对象
try:
llm_content, (reasoning_content, _, _) = await self.planner_small_llm.generate_response_async(prompt=prompt)
@@ -581,7 +581,7 @@ class ActionPlanner:
sub_plan_results = await asyncio.gather(*sub_plan_tasks)
# 收集所有结果
all_sub_planner_results = []
all_sub_planner_results: List[ActionPlannerInfo] = []
for sub_result in sub_plan_results:
all_sub_planner_results.extend(sub_result)
@@ -679,9 +679,12 @@ class ActionPlanner:
reasoning = f"Planner 内部处理错误: {outer_e}"
is_parallel = True
if mode == ChatMode.NORMAL and action in current_available_actions:
if is_parallel:
is_parallel = current_available_actions[action].parallel_action
for action_planner_info in all_sub_planner_results:
if action_planner_info.action_type == "no_action":
continue
if not current_available_actions[action_planner_info.action_type].parallel_action:
is_parallel = False
break
action_data["loop_start_time"] = loop_start_time
@@ -720,8 +723,11 @@ class ActionPlanner:
)
]
action_str = ""
for action in actions:
action_str += f"{action.action_type} "
logger.info(
f"{self.log_prefix}并行模式:返回主规划器{len(main_actions)}action + 副规划器{len(all_sub_planner_results)}个action过滤后总计{len(actions)}个action"
f"{self.log_prefix}大脑小脑决定执行{len(actions)}动作: {action_str}"
)
else:
# 如果为假,只返回副规划器的结果
@@ -739,7 +745,7 @@ class ActionPlanner:
)
]
logger.info(f"{self.log_prefix}非并行模式:返回副规划器{len(actions)}action已过滤no_action")
logger.info(f"{self.log_prefix}跳过大脑,执行小脑{len(actions)}动作")
return actions, target_message