增加环绕侦察场景适配
This commit is contained in:
@@ -485,6 +485,11 @@ def _add_nodes_and_edges(node: dict, dot, parent_id: str | None = None) -> str:
|
||||
|
||||
# 递归处理子节点 (Sequence, Selector, Parallel 等)
|
||||
children = node.get("children", [])
|
||||
|
||||
# 兼容 decorator 类型的 child 字段 (处理为单元素列表以便统一逻辑)
|
||||
if node_type == 'decorator' and 'child' in node:
|
||||
children = [node['child']]
|
||||
|
||||
if children:
|
||||
# 记录所有子节点的ID
|
||||
child_ids = []
|
||||
@@ -501,10 +506,10 @@ def _add_nodes_and_edges(node: dict, dot, parent_id: str | None = None) -> str:
|
||||
for cid in child_ids:
|
||||
s.node(cid)
|
||||
|
||||
# 递归处理单子节点 (Decorator)
|
||||
child = node.get("child")
|
||||
if child:
|
||||
_add_nodes_and_edges(child, dot, current_id)
|
||||
# 递归处理单子节点 (Decorator) - 已合并到 children 处理逻辑中,此处删除旧逻辑
|
||||
# child = node.get("child")
|
||||
# if child:
|
||||
# _add_nodes_and_edges(child, dot, current_id)
|
||||
|
||||
return current_id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user