Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Chore: remove dead code in class Graph (#22791)
Yongtao Huangac057a2d4019
diff --git a/api/core/model_runtime/README.md b/api/core/model_runtime/README.mdindex 3abb3f63acc..a6caa7eb1e1 100644--- a/api/core/model_runtime/README.md+++ b/api/core/model_runtime/README.md@@ -7,7 +7,7 @@ This module provides the interface for invoking and authenticating various model## Features-- Supports capability invocation for 5 types of models+- Supports capability invocation for 6 types of models- `LLM` - LLM text completion, dialogue, pre-computed tokens capability- `Text Embedding Model` - Text Embedding, pre-computed tokens capabilitydiff --git a/api/core/model_runtime/README_CN.md b/api/core/model_runtime/README_CN.mdindex 19846481e0f..dfe614347ab 100644--- a/api/core/model_runtime/README_CN.md+++ b/api/core/model_runtime/README_CN.md@@ -7,7 +7,7 @@## 功能介绍-- 支持 5 种模型类型的能力调用+- 支持 6 种模型类型的能力调用- `LLM` - LLM 文本补全、对话,预计算 tokens 能力- `Text Embedding Model` - 文本 Embedding,预计算 tokens 能力diff --git a/api/core/workflow/graph_engine/entities/graph.py b/api/core/workflow/graph_engine/entities/graph.pyindex 362777a199d..49984806c9a 100644--- a/api/core/workflow/graph_engine/entities/graph.py+++ b/api/core/workflow/graph_engine/entities/graph.py@@ -204,47 +204,6 @@ class Graph(BaseModel):return graph- def add_extra_edge(- self, source_node_id: str, target_node_id: str, run_condition: Optional[RunCondition] = None- ) -> None:- """- Add extra edge to the graph-- :param source_node_id: source node id- :param target_node_id: target node id- :param run_condition: run condition- """- if source_node_id not in self.node_ids or target_node_id not in self.node_ids:- return-- if source_node_id not in self.edge_mapping:- self.edge_mapping[source_node_id] = []-- if target_node_id in [graph_edge.target_node_id for graph_edge in self.edge_mapping[source_node_id]]:- return-- graph_edge = GraphEdge(- source_node_id=source_node_id, target_node_id=target_node_id, run_condition=run_condition- )-- self.edge_mapping[source_node_id].append(graph_edge)-- def get_leaf_node_ids(self) -> list[str]:- """- Get leaf node ids of the graph-- :return: leaf node ids- """- leaf_node_ids = []- for node_id in self.node_ids:- if node_id not in self.edge_mapping or (- len(self.edge_mapping[node_id]) == 1- and self.edge_mapping[node_id][0].target_node_id == self.root_node_id- ):- leaf_node_ids.append(node_id)-- return leaf_node_ids-@classmethoddef _recursively_add_node_ids(cls, node_ids: list[str], edge_mapping: dict[str, list[GraphEdge]], node_id: str@@ -681,11 +640,8 @@ class Graph(BaseModel):if start_node_id not in reverse_edge_mapping:return False- all_routes_node_ids = set()parallel_start_node_ids: dict[str, list[str]] = {}- for branch_node_id, node_ids in routes_node_ids.items():- all_routes_node_ids.update(node_ids)-+ for branch_node_id in routes_node_ids:if branch_node_id in reverse_edge_mapping:for graph_edge in reverse_edge_mapping[branch_node_id]:if graph_edge.source_node_id not in parallel_start_node_ids:@@ -693,8 +649,9 @@ class Graph(BaseModel):parallel_start_node_ids[graph_edge.source_node_id].append(branch_node_id)+ expected_branch_set = set(routes_node_ids.keys())for _, branch_node_ids in parallel_start_node_ids.items():- if set(branch_node_ids) == set(routes_node_ids.keys()):+ if set(branch_node_ids) == expected_branch_set:return Truereturn Falsediff --git a/api/tests/unit_tests/core/workflow/graph_engine/test_graph.py b/api/tests/unit_tests/core/workflow/graph_engine/test_graph.pyindex 13ba11016a0..7660cd6ea0d 100644--- a/api/tests/unit_tests/core/workflow/graph_engine/test_graph.py+++ b/api/tests/unit_tests/core/workflow/graph_engine/test_graph.py@@ -1,6 +1,4 @@from core.workflow.graph_engine.entities.graph import Graph-from core.workflow.graph_engine.entities.run_condition import RunCondition-from core.workflow.utils.condition.entities import Conditiondef test_init():@@ -162,14 +160,6 @@ def test__init_iteration_graph():}graph = Graph.init(graph_config=graph_config, root_node_id="template-transform-in-iteration")- graph.add_extra_edge(- source_node_id="answer-in-iteration",- target_node_id="template-transform-in-iteration",- run_condition=RunCondition(- type="condition",- conditions=[Condition(variable_selector=["iteration", "index"], comparison_operator="≤", value="5")],- ),- )# iteration:# [template-transform-in-iteration -> llm-in-iteration -> answer-in-iteration]@@ -177,7 +167,6 @@ def test__init_iteration_graph():assert graph.root_node_id == "template-transform-in-iteration"assert graph.edge_mapping.get("template-transform-in-iteration")[0].target_node_id == "llm-in-iteration"assert graph.edge_mapping.get("llm-in-iteration")[0].target_node_id == "answer-in-iteration"- assert graph.edge_mapping.get("answer-in-iteration")[0].target_node_id == "template-transform-in-iteration"def test_parallels_graph():