feat(backend): 스트림 타임아웃 env 화 — 첫 이벤트 300s, FabriX 조각 간 300s 기본

Gemma4 가 큐 밀리면 '안녕'에도 200초라 첫 이벤트 60s 로는 no-events 로 잘림.
STREAM_FIRST_EVENT_TIMEOUT_S / STREAM_TURN_TIMEOUT_S / AAF_FABRIX_READ_TIMEOUT_S / AAF_FABRIX_TOTAL_TIMEOUT_S 를 .env 로.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
lee-hyeon-cheol
2026-09-21 13:31:00 +09:00
co-authored by Claude Fable 5.1
parent e9e644b15b
commit aa37cef13d
5 changed files with 20 additions and 3 deletions
+5 -1
View File
@@ -31,6 +31,8 @@ ENV_KEYS = (
"AAF_RELAY_STREAM_USAGE", # "1" 이면 stream_options.include_usage — 제공자가 거부하면 끔
"AAF_GATEWAY_KEY", # OpenCode 가 Authorization: Bearer 로 보내는 키. 비우면 검사 안 함
"AAF_FABRIX_VISION_MODEL_ID", # 이미지가 붙은 요청만 이 모델로(Gemma4). 비우면 분기 안 함
"AAF_FABRIX_READ_TIMEOUT_S", # 스트림 조각 사이 무수신 한계(기본 300). Gemma 가 중간에 멈추는 날 대비
"AAF_FABRIX_TOTAL_TIMEOUT_S", # 요청 전체 상한(기본 600)
)
@@ -81,7 +83,7 @@ class FabrixConfig:
gateway_key: str = ""
vision_model_id: str = "" # 이미지 있을 때만 쓰는 모델. Gemma 가 느려서 텍스트는 기본 모델로
connect_timeout_s: float = 10.0
read_timeout_s: float = 120.0 # 스트림 조각 사이 무수신 한계
read_timeout_s: float = 300.0 # 스트림 조각 사이 무수신 한계
total_timeout_s: float = 600.0
@classmethod
@@ -102,6 +104,8 @@ class FabrixConfig:
stream_usage=g("AAF_RELAY_STREAM_USAGE") == "1",
gateway_key=g("AAF_GATEWAY_KEY"),
vision_model_id=g("AAF_FABRIX_VISION_MODEL_ID"),
read_timeout_s=float(g("AAF_FABRIX_READ_TIMEOUT_S") or 300),
total_timeout_s=float(g("AAF_FABRIX_TOTAL_TIMEOUT_S") or 600),
)
def missing(self) -> list[str]: