From 94b946c715c4ad6f07feb0f1548924d81763555c Mon Sep 17 00:00:00 2001 From: -LAN- Date: Mon, 30 Sep 2024 13:09:21 +0800 Subject: [PATCH] fix(document_extractor): handle empty variable values properly - Added check for variable.value existence before type validation. - Prevents erroneous type checks on empty variables, improving robustness. --- .../nodes/document_extractor/document_extractor_node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/document_extractor/document_extractor_node.py b/api/core/workflow/nodes/document_extractor/document_extractor_node.py index 7ed572c9ae..2f96215b33 100644 --- a/api/core/workflow/nodes/document_extractor/document_extractor_node.py +++ b/api/core/workflow/nodes/document_extractor/document_extractor_node.py @@ -41,7 +41,7 @@ class DocumentExtractorNode(BaseNode): if variable is None: error_message = f"File variable not found for selector: {variable_selector}" return NodeRunResult(status=WorkflowNodeExecutionStatus.FAILED, error=error_message) - if not isinstance(variable, ArrayFileSegment | FileSegment): + if variable.value and not isinstance(variable, ArrayFileSegment | FileSegment): error_message = f"Variable {variable_selector} is not an ArrayFileSegment" return NodeRunResult(status=WorkflowNodeExecutionStatus.FAILED, error=error_message)