lanna_lalala;- commited on
Commit
f3957b2
·
2 Parent(s): 9d421af36e77cd

Merge branch 'main' of https://github.com/Alalalallalalalalalalalal/Frontend

Browse files
Files changed (1) hide show
  1. utils/api.py +5 -1
utils/api.py CHANGED
@@ -337,7 +337,11 @@ def chat_ai(query: str, lesson_id: int, level_slug: str, history=None) -> str:
337
  "history": history or [],
338
  }
339
  try:
340
- d = _json_or_raise(_req("POST", "/chat", json=payload))
 
 
 
 
341
  return d.get("answer", "")
342
  except Exception as e:
343
  return f"(chat failed: {e})"
 
337
  "history": history or [],
338
  }
339
  try:
340
+ # Force the full path without relying on _prefixes
341
+ url = f"{BACKEND}/chat" # make sure BACKEND has no trailing slash
342
+ r = _session.post(url, json=payload, timeout=DEFAULT_TIMEOUT)
343
+ r.raise_for_status()
344
+ d = r.json()
345
  return d.get("answer", "")
346
  except Exception as e:
347
  return f"(chat failed: {e})"