diff --git a/backend/atlas_portal/routes/ai.py b/backend/atlas_portal/routes/ai.py index c695d65..b534a61 100644 --- a/backend/atlas_portal/routes/ai.py +++ b/backend/atlas_portal/routes/ai.py @@ -36,9 +36,23 @@ def register(app) -> None: elapsed_ms = int((time.time() - started) * 1000) return jsonify({"reply": reply, "latency_ms": elapsed_ms, "source": source}) elapsed_ms = int((time.time() - started) * 1000) + if mode == "quick": + budget = max(1, int(round(settings.AI_ATLASBOT_TIMEOUT_QUICK_SEC))) + fallback = ( + f"Quick mode hit {budget}s response budget before finishing. " + "Try atlas-smart for a deeper answer." + ) + elif mode == "smart": + budget = max(1, int(round(settings.AI_ATLASBOT_TIMEOUT_SMART_SEC))) + fallback = ( + f"Smart mode hit {budget}s response budget before finishing. " + "Try atlas-genius or ask a narrower follow-up." + ) + else: + fallback = "Atlas genius mode timed out before it could finish. Please retry with a narrower prompt." return jsonify( { - "reply": "Atlasbot is busy. Please try again in a moment.", + "reply": fallback, "latency_ms": elapsed_ms, "source": source, }