MCPcopy Create free account
hub / github.com/DSGWJQ/Feagent / execute

Method execute

src/infrastructure/executors/loop_executor.py:56–79  ·  view source on GitHub ↗

执行循环节点 参数: node: 节点实体 inputs: 输入数据(来自前驱节点) context: 执行上下文 返回: 所有迭代结果的数组

(self, node: Node, inputs: dict[str, Any], context: dict[str, Any])

Source from the content-addressed store, hash-verified

54 }
55
56 async def execute(self, node: Node, inputs: dict[str, Any], context: dict[str, Any]) -> Any:
57 """执行循环节点
58
59 参数:
60 node: 节点实体
61 inputs: 输入数据(来自前驱节点)
62 context: 执行上下文
63
64 返回:
65 所有迭代结果的数组
66 """
67 loop_type = node.config.get("type", "")
68
69 if not loop_type:
70 raise DomainError("Loop 节点缺少循环类型")
71
72 if loop_type == "for_each":
73 return await self._for_each_loop(node.config, inputs, context)
74 elif loop_type == "range":
75 return await self._range_loop(node.config, inputs, context)
76 elif loop_type == "while":
77 return await self._while_loop(node.config, inputs, context)
78 else:
79 raise DomainError(f"不支持的循环类型: {loop_type}")
80
81 async def _for_each_loop(
82 self, config: dict, inputs: dict[str, Any], context: dict[str, Any]

Callers

nothing calls this directly

Calls 5

_for_each_loopMethod · 0.95
_range_loopMethod · 0.95
_while_loopMethod · 0.95
DomainErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected