fix(workflow): normalize output node type comparison and fix validator error message spacing
This commit is contained in:
@@ -21,6 +21,7 @@ from app.core.workflow.nodes import NodeFactory
|
||||
from app.core.workflow.nodes.enums import NodeType, BRANCH_NODES
|
||||
from app.core.workflow.utils.expression_evaluator import evaluate_condition
|
||||
from app.core.workflow.validator import WorkflowValidator
|
||||
from app.core.workflow.variable.base_variable import VariableType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -194,7 +195,7 @@ class GraphBuilder:
|
||||
outputs_list = config.get("outputs", [])
|
||||
output = "\n".join(
|
||||
item.get("value", "") for item in outputs_list
|
||||
if item.get("value") and item.get("type", "string") == "string"
|
||||
if item.get("value") and item.get("type", VariableType.STRING) == VariableType.STRING
|
||||
) or None
|
||||
else:
|
||||
output = config.get("output")
|
||||
|
||||
@@ -135,7 +135,7 @@ class WorkflowValidator:
|
||||
# 2. 验证 主图end 节点(至少一个,output 节点也可作为终止节点)
|
||||
end_nodes = [n for n in nodes if n.get("type") in [NodeType.END, NodeType.OUTPUT]]
|
||||
if len(end_nodes) == 0:
|
||||
errors.append("工作流必须至少有一个 end 节点 或 output节点")
|
||||
errors.append("工作流必须至少有一个 end 节点 或 output 节点")
|
||||
|
||||
# 3. 验证节点 ID 唯一性
|
||||
node_ids = [n.get("id") for n in nodes if n.get("type") != NodeType.NOTES]
|
||||
|
||||
Reference in New Issue
Block a user