Essi commited on
Commit
fd1efdc
·
1 Parent(s): 60a50f7

refactor: rename fetch_task_file to fetch_task_attachment for clarity in attachment handling

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. helpers.py +1 -1
app.py CHANGED
@@ -9,7 +9,7 @@ from langchain_core.messages import HumanMessage, SystemMessage
9
  from langchain_openai import ChatOpenAI
10
  from langgraph.graph import END, StateGraph
11
 
12
- from helpers import fetch_task_file, get_prompt, sniff_excel_type
13
  from tools import (
14
  analyze_excel_file,
15
  calculator,
@@ -85,7 +85,7 @@ def gather_context(state: AgentState) -> AgentState:
85
 
86
  # ---- attachment detection ------------------------------------------------
87
  if task_id:
88
- blob, ctype = fetch_task_file(api_url=DEFAULT_API_URL, task_id=task_id)
89
 
90
  if any([blob, ctype]):
91
  print(f"[DEBUG] attachment type={ctype} ")
 
9
  from langchain_openai import ChatOpenAI
10
  from langgraph.graph import END, StateGraph
11
 
12
+ from helpers import fetch_task_attachment, get_prompt, sniff_excel_type
13
  from tools import (
14
  analyze_excel_file,
15
  calculator,
 
85
 
86
  # ---- attachment detection ------------------------------------------------
87
  if task_id:
88
+ blob, ctype = fetch_task_attachment(api_url=DEFAULT_API_URL, task_id=task_id)
89
 
90
  if any([blob, ctype]):
91
  print(f"[DEBUG] attachment type={ctype} ")
helpers.py CHANGED
@@ -13,7 +13,7 @@ CURRENT_DIR = Path(__file__).parent
13
  _PROMPTS = safe_load(CURRENT_DIR.joinpath("prompts.yaml").read_text())
14
 
15
 
16
- def fetch_task_file(api_url: str, task_id: str) -> tuple[bytes, str]:
17
  """
18
  Returns (file_bytes, content_type) or (b'', '') if no attachment found.
19
  Follows any redirect the endpoint issues.
 
13
  _PROMPTS = safe_load(CURRENT_DIR.joinpath("prompts.yaml").read_text())
14
 
15
 
16
+ def fetch_task_attachment(api_url: str, task_id: str) -> tuple[bytes, str]:
17
  """
18
  Returns (file_bytes, content_type) or (b'', '') if no attachment found.
19
  Follows any redirect the endpoint issues.