shim: original model names (no qw- prefix), 502 on empty upstream answer; sql: orig names + prefix purge

This commit is contained in:
ENI
2026-11-22 01:44:33 +02:00
parent fa07ac3a29
commit 40d73a2a84
+19 -13
View File
@@ -42,19 +42,19 @@ UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
# iishko model name -> qwenwork chat mode # iishko model name -> qwenwork chat mode
MODES = { MODES = {
"qw-flash": "flash", "flash": "flash",
"qw-standard": "flash", "standard": "flash",
"qw-pro": "advanced", "pro": "advanced",
"qw-advanced": "advanced", "advanced": "advanced",
"qw-flagship": "pro", "flagship": "pro",
"qw-qwen4-max": "qwen4-max", "qwen4-max": "qwen4-max",
"qw-qwen3.8-max": "qwen3.8-max", "qwen3.8-max": "qwen3.8-max",
"qw-qwen3.8-flash": "qwen3.8-flash", "qwen3.8-flash": "qwen3.8-flash",
"qw-deepseek-v4.1-flash": "deepseek-flash", "deepseek-v4.1-flash": "deepseek-flash",
"qw-glm-5.3": "glm-5.3", "glm-5.3": "glm-5.3",
"qw-glm-5.3-flash": "glm-5.3-flash", "glm-5.3-flash": "glm-5.3-flash",
"qw-kimi-k3.1-pro": "kimi-k3.1-pro", "kimi-k3.1-pro": "kimi-k3.1-pro",
"qw-minimax-m3.1-flash": "minimax-m3.1-flash", "minimax-m3.1-flash": "minimax-m3.1-flash",
} }
_lock = threading.Lock() _lock = threading.Lock()
@@ -315,6 +315,12 @@ class H(BaseHTTPRequestHandler):
return self._json(code, {"error": {"message": (last_err.msg if last_err else "upstream failed"), return self._json(code, {"error": {"message": (last_err.msg if last_err else "upstream failed"),
"type": "upstream_error"}}) "type": "upstream_error"}})
ans = ans or "" ans = ans or ""
if not ans.strip():
# [EMPTY502 1121] upstream created the session but never emitted agent_message_chunk;
# returning an empty 200 poisons the gateway (user sees nothing, credits burned).
return self._json(502, {"error": {"message": "empty answer from qwenwork (no agent_message_chunk)",
"type": "upstream_error"},
"x_qwenwork_session": sid})
tid = "chatcmpl-" + uuid.uuid4().hex[:24] tid = "chatcmpl-" + uuid.uuid4().hex[:24]
created = int(time.time()) created = int(time.time())