From 53bb37b749532efce5bb743143279008c61a4b3d Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Wed, 8 Jan 2025 12:52:45 +0800 Subject: [PATCH] fix: fix the incorrect plaintext file key when saving (#10429) --- api/core/rag/extractor/pdf_extractor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/core/rag/extractor/pdf_extractor.py b/api/core/rag/extractor/pdf_extractor.py index 89a7061c26accc..04033dec3fa56d 100644 --- a/api/core/rag/extractor/pdf_extractor.py +++ b/api/core/rag/extractor/pdf_extractor.py @@ -23,7 +23,6 @@ def __init__(self, file_path: str, file_cache_key: Optional[str] = None): self._file_cache_key = file_cache_key def extract(self) -> list[Document]: - plaintext_file_key = "" plaintext_file_exists = False if self._file_cache_key: try: @@ -39,8 +38,8 @@ def extract(self) -> list[Document]: text = "\n\n".join(text_list) # save plaintext file for caching - if not plaintext_file_exists and plaintext_file_key: - storage.save(plaintext_file_key, text.encode("utf-8")) + if not plaintext_file_exists and self._file_cache_key: + storage.save(self._file_cache_key, text.encode("utf-8")) return documents