Raise warm-call timeouts (text 8->20s, FLUX 12->30s) so the hosted Space gets real AI + comics instead of cold-start fallbacks
Browse files- game/comic.py +3 -1
- game/llm.py +4 -2
game/comic.py
CHANGED
|
@@ -15,7 +15,9 @@ import requests
|
|
| 15 |
|
| 16 |
from .trace import trace
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
FLUX_COLD_TIMEOUT = float(os.environ.get("BDS_FLUX_COLD_TIMEOUT", "90"))
|
| 20 |
_warmed = False
|
| 21 |
|
|
|
|
| 15 |
|
| 16 |
from .trace import trace
|
| 17 |
|
| 18 |
+
# 30s warm default: on a hosted Space a slightly-cold / loaded FLUX container
|
| 19 |
+
# needs more than 12s, else panels silently no-op. Warm renders are ~3-6s.
|
| 20 |
+
FLUX_TIMEOUT = float(os.environ.get("BDS_FLUX_TIMEOUT", "30"))
|
| 21 |
FLUX_COLD_TIMEOUT = float(os.environ.get("BDS_FLUX_COLD_TIMEOUT", "90"))
|
| 22 |
_warmed = False
|
| 23 |
|
game/llm.py
CHANGED
|
@@ -20,8 +20,10 @@ from .schemas import SCHEMA_BY_CALL_TYPE
|
|
| 20 |
from .state import GameState
|
| 21 |
from .trace import trace, trace_payload
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
# the FIRST call to a cold Modal container waits longer (boot + model load)
|
| 26 |
COLD_TIMEOUT = float(os.environ.get("BDS_COLD_TIMEOUT", "55"))
|
| 27 |
_warmed = False # flips true after the first successful live response
|
|
|
|
| 20 |
from .state import GameState
|
| 21 |
from .trace import trace, trace_payload
|
| 22 |
|
| 23 |
+
# warm-call ceiling. 20s default so a hosted Space (cold/loaded Modal containers,
|
| 24 |
+
# concurrent players) gets real AI instead of constant fallbacks; lower via env
|
| 25 |
+
# (run_modal.ps1 sets 20 explicitly) — 9B crisis JSON warm-generates in ~8-12s.
|
| 26 |
+
TIMEOUT_S = float(os.environ.get("BDS_LLM_TIMEOUT", "20"))
|
| 27 |
# the FIRST call to a cold Modal container waits longer (boot + model load)
|
| 28 |
COLD_TIMEOUT = float(os.environ.get("BDS_COLD_TIMEOUT", "55"))
|
| 29 |
_warmed = False # flips true after the first successful live response
|