lamhieu commited on
Commit
c82aac4
Β·
1 Parent(s): 9c192bf

chore: update something

Browse files
Files changed (1) hide show
  1. docsifer/service.py +3 -2
docsifer/service.py CHANGED
@@ -13,7 +13,6 @@ import tiktoken
13
  from pyquery import PyQuery as pq
14
  from markitdown import MarkItDown
15
  from openai import OpenAI
16
- from youtube_transcript_api import YouTubeTranscriptApi
17
 
18
  logger = logging.getLogger(__name__)
19
  logging.basicConfig(level=logging.INFO)
@@ -144,6 +143,8 @@ class DocsiferService:
144
  new_filename = f"{src.stem}{guessed_ext}"
145
  tmp_path = Path(tmpdir) / new_filename
146
  tmp_path.write_bytes(src.read_bytes())
 
 
147
 
148
  logger.info(
149
  "Using temp file: %s, MIME type: %s, Guessed ext: %s",
@@ -156,7 +157,7 @@ class DocsiferService:
156
  if cleanup and guessed_ext.lower() in (".html", ".htm"):
157
  self._maybe_cleanup_html(tmp_path)
158
 
159
- filename = src.name
160
  source = str(tmp_path)
161
 
162
  # Decide whether to use LLM-enhanced conversion or the basic converter.
 
13
  from pyquery import PyQuery as pq
14
  from markitdown import MarkItDown
15
  from openai import OpenAI
 
16
 
17
  logger = logging.getLogger(__name__)
18
  logging.basicConfig(level=logging.INFO)
 
143
  new_filename = f"{src.stem}{guessed_ext}"
144
  tmp_path = Path(tmpdir) / new_filename
145
  tmp_path.write_bytes(src.read_bytes())
146
+ if not tmp_path.exists():
147
+ raise FileNotFoundError(f"Temporary file not found: {tmp_path}")
148
 
149
  logger.info(
150
  "Using temp file: %s, MIME type: %s, Guessed ext: %s",
 
157
  if cleanup and guessed_ext.lower() in (".html", ".htm"):
158
  self._maybe_cleanup_html(tmp_path)
159
 
160
+ filename = new_filename
161
  source = str(tmp_path)
162
 
163
  # Decide whether to use LLM-enhanced conversion or the basic converter.