Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix(nodes): handle errors in question_classifier and parameter_extractor (#11927)

-LAN-c07d9e96ce6d
diff --git a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py
index 5b960ea6151..c8c854a43b3 100644
--- a/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py
+++ b/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py
@@ -179,6 +179,15 @@ class ParameterExtractorNode(LLMNode):
error=str(e),
metadata={},
)
+ except Exception as e:
+ return NodeRunResult(
+ status=WorkflowNodeExecutionStatus.FAILED,
+ inputs=inputs,
+ process_data=process_data,
+ outputs={"__is_success": 0, "__reason": "Failed to invoke model", "__error": str(e)},
+ error=str(e),
+ metadata={},
+ )
error = None
diff --git a/api/core/workflow/nodes/question_classifier/question_classifier_node.py b/api/core/workflow/nodes/question_classifier/question_classifier_node.py
index 15cfabe4780..5043e25e2b8 100644
--- a/api/core/workflow/nodes/question_classifier/question_classifier_node.py
+++ b/api/core/workflow/nodes/question_classifier/question_classifier_node.py
@@ -154,8 +154,7 @@ class QuestionClassifierNode(LLMNode):
},
llm_usage=usage,
)
-
- except ValueError as e:
+ except Exception as e:
return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
inputs=variables,