fix(workflow): normalize output node type comparison and fix validator error message spacing

This commit is contained in:
Timebomb2018
2026-04-21 17:50:31 +08:00
parent 9533a9a693
commit 93d4607b14
2 changed files with 3 additions and 2 deletions

View File

@@ -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")

View File

@@ -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]