fix: LLM timeout 60→120с + graceful fallback без 500 ошибки

This commit is contained in:
Repinoid
2026-05-28 10:48:32 +03:00
parent d1903008c6
commit 84bd0cb34a
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -86,7 +86,11 @@ def register(app):
model=cfg["llm"].get("model", "gpt-oss-120b"),
base_url=cfg["llm"].get("base_url", "https://api.aillm.ru/v1"),
)
answer = diagnoser.diagnose(SYSTEM_PROMPT, _build_diagnosis_prompt(parsed))
try:
answer = diagnoser.diagnose(SYSTEM_PROMPT, _build_diagnosis_prompt(parsed))
except Exception as e:
logger.warning(f"LLM failed: {e}")
answer = format_no_llm(parsed) + f"\n\n(LLM недоступен: {e})"
return jsonify({
"diagnosis": answer,