Skip to content

Commit

Permalink
fix:: Missing return statement [return]
Browse files Browse the repository at this point in the history
fix:: Missing return statement  [return]
  • Loading branch information
ic-xu committed Dec 27, 2024
1 parent 6b863eb commit 714646f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/core/workflow/nodes/document_extractor/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _run(self):
try:
if isinstance(value, list):
if output_image:
images = _extract_images_from_file(files=value, user=current_user)
images = _extract_images_from_file(files=value)
extracted_text_list = list(map(_extract_text_from_file, value))
return NodeRunResult(
status=WorkflowNodeExecutionStatus.SUCCEEDED,
Expand All @@ -69,7 +69,7 @@ def _run(self):
)
elif isinstance(value, File):
if output_image:
images = _extract_images_from_file([value], user=current_user)
images = _extract_images_from_file([value])
extracted_text = _extract_text_from_file(value)
return NodeRunResult(
status=WorkflowNodeExecutionStatus.SUCCEEDED,
Expand Down Expand Up @@ -223,7 +223,7 @@ def _extract_images_from_pdf(file: File) -> list[File]:
raise Exception(f"Failed to convert PDF to images: {e}")


def _extract_images_from_file(files: list[File], user) -> list[File]:
def _extract_images_from_file(files: list[File]):
try:
for file in files:
if file.extension:
Expand All @@ -236,6 +236,7 @@ def _extract_images_from_file(files: list[File], user) -> list[File]:
return []
else:
raise UnsupportedFileTypeError("Unable to determine file type: MIME type or file extension is missing")
return []
except Exception as e:
raise TextExtractionError(f"Failed to extract image from PDF: {str(e)}") from e

Expand Down

0 comments on commit 714646f

Please sign in to comment.