Skip to content

Commit

Permalink
fix(extractor): temporary file (#10543)
Browse files Browse the repository at this point in the history
  • Loading branch information
laipz8200 authored Nov 11, 2024
1 parent 9008716 commit a1543b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/core/rag/extractor/word_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def __init__(self, file_path: str, tenant_id: str, user_id: str):

self.web_path = self.file_path
# TODO: use a better way to handle the file
with tempfile.NamedTemporaryFile(delete=False) as self.temp_file:
self.temp_file.write(r.content)
self.file_path = self.temp_file.name
self.temp_file = tempfile.NamedTemporaryFile() # noqa: SIM115
self.temp_file.write(r.content)
self.file_path = self.temp_file.name
elif not os.path.isfile(self.file_path):
raise ValueError(f"File path {self.file_path} is not a valid file or url")

Expand Down

0 comments on commit a1543b7

Please sign in to comment.