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

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN- 2024-12-21 21:21:57 +08:00 committed by GitHub
parent 810adb8a94
commit c07d9e96ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -179,6 +179,15 @@ class ParameterExtractorNode(LLMNode):
error=str(e), error=str(e),
metadata={}, 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 error = None

View File

@ -154,8 +154,7 @@ class QuestionClassifierNode(LLMNode):
}, },
llm_usage=usage, llm_usage=usage,
) )
except Exception as e:
except ValueError as e:
return NodeRunResult( return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED, status=WorkflowNodeExecutionStatus.FAILED,
inputs=variables, inputs=variables,