feat(document_extractor): support tool file in document extractor (#10217)

This commit is contained in:
-LAN- 2024-11-05 09:49:43 +08:00 committed by Yeuoly
parent 5d2c88ef59
commit 2cd976846a
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61

View File

@ -198,10 +198,8 @@ def _download_file_content(file: File) -> bytes:
response = ssrf_proxy.get(file.remote_url) response = ssrf_proxy.get(file.remote_url)
response.raise_for_status() response.raise_for_status()
return response.content return response.content
elif file.transfer_method == FileTransferMethod.LOCAL_FILE:
return file_manager.download(file)
else: else:
raise ValueError(f"Unsupported transfer method: {file.transfer_method}") return file_manager.download(file)
except Exception as e: except Exception as e:
raise FileDownloadError(f"Error downloading file: {str(e)}") from e raise FileDownloadError(f"Error downloading file: {str(e)}") from e