Nymbo commited on
Commit
8fa985e
·
verified ·
1 Parent(s): 3dedaec

Update Modules/Deep_Research.py

Browse files
Files changed (1) hide show
  1. Modules/Deep_Research.py +4 -2
Modules/Deep_Research.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import re
5
  import tempfile
6
  import time
 
7
  from collections import OrderedDict, deque
8
  from concurrent.futures import Future, ThreadPoolExecutor, as_completed
9
  from datetime import datetime
@@ -19,6 +20,7 @@ from huggingface_hub import InferenceClient
19
  from .Web_Fetch import _fullpage_markdown_from_soup, _http_get_enhanced
20
  from app import _log_call_end, _log_call_start, _search_rate_limiter, _truncate_for_log
21
  from ._docstrings import autodoc
 
22
 
23
  HF_TEXTGEN_TOKEN = os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN")
24
 
@@ -215,8 +217,8 @@ def _parse_filterer_output(raw: str, allowed_urls: List[str]) -> List[str]:
215
 
216
 
217
  def _write_report_tmp(text: str) -> str:
218
- tmp_dir = tempfile.mkdtemp(prefix="deep_research_")
219
- path = os.path.join(tmp_dir, "research_report.txt")
220
  with open(path, "w", encoding="utf-8") as file:
221
  file.write(text)
222
  return path
 
4
  import re
5
  import tempfile
6
  import time
7
+ import uuid
8
  from collections import OrderedDict, deque
9
  from concurrent.futures import Future, ThreadPoolExecutor, as_completed
10
  from datetime import datetime
 
20
  from .Web_Fetch import _fullpage_markdown_from_soup, _http_get_enhanced
21
  from app import _log_call_end, _log_call_start, _search_rate_limiter, _truncate_for_log
22
  from ._docstrings import autodoc
23
+ from .File_System import ROOT_DIR
24
 
25
  HF_TEXTGEN_TOKEN = os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN")
26
 
 
217
 
218
 
219
  def _write_report_tmp(text: str) -> str:
220
+ filename = f"research_report_{uuid.uuid4().hex}.txt"
221
+ path = os.path.join(ROOT_DIR, filename)
222
  with open(path, "w", encoding="utf-8") as file:
223
  file.write(text)
224
  return path