🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
refine comments
geekanad1edf60927e
diff --git a/metagpt/actions/action_graph.py b/metagpt/actions/action_graph.pyindex 8570778c7..893bc6d4c 100644--- a/metagpt/actions/action_graph.py+++ b/metagpt/actions/action_graph.py@@ -11,7 +11,7 @@ from __future__ import annotationsclass ActionGraph:- """ActionGraph: 用于定义一个图,图中的节点是 ActionNode 实例,节点间的依赖关系是有向边。"""+ """ActionGraph: a directed graph to represent the dependency between actions."""def __init__(self):self.nodes = {}@@ -19,18 +19,11 @@ class ActionGraph:self.execution_order = []def add_node(self, node):- """- 添加一个节点到图中。- :param node: ActionNode 实例- """+ """Add a node to the graph"""self.nodes[node.key] = nodedef add_edge(self, from_node: "ActionNode", to_node: "ActionNode"):- """- 定义节点间的依赖关系。- :param from_node: 节点标识- :param to_node: 节点标识- """+ """Add an edge to the graph"""if from_node.key not in self.edges:self.edges[from_node.key] = []self.edges[from_node.key].append(to_node.key)@@ -38,9 +31,7 @@ class ActionGraph:to_node.add_prev(from_node)def topological_sort(self):- """- 实现拓扑排序来确定执行顺序。- """+ """Topological sort the graph"""visited = set()stack = []