fix: request no reasoning for liveness and handle empty text
Build and deploy / build-deploy (push) Waiting to run

This commit is contained in:
2026-10-27 11:58:56 +00:00
parent 631b44666f
commit e8177c1270
4 changed files with 51 additions and 6 deletions
+6 -2
View File
@@ -638,6 +638,7 @@ def api_check(model_id: str):
"model": model_id,
"messages": [{"role": "user", "content": "What is 2+2? Reply with just the number."}],
"max_tokens": 5,
"reasoning_effort": "none",
}).encode()
req = urllib.request.Request(
f"{OMNIROUTE_URL}/v1/chat/completions",
@@ -652,8 +653,11 @@ def api_check(model_id: str):
# Usage фиксируем ДО валидации контента: даже если парсинг choices
# упадёт, реально потраченные токены сохраняются в checks.
usage = extract_usage(resp)
content = resp["choices"][0]["message"]["content"]
ok = bool(content.strip())
choice = resp["choices"][0]
content = choice["message"].get("content")
ok = isinstance(content, str) and bool(content.strip())
if not ok:
error = f"Empty text response (finish_reason={choice.get('finish_reason')})"
except Exception as e:
error = f"{type(e).__name__}: {e}"
print(f"[check] {model_id}: {error}")
+8 -2
View File
@@ -37,6 +37,7 @@ def check_model(model_id: str) -> tuple[bool, int | None, str | None, dict]:
"model": model_id,
"messages": [{"role": "user", "content": "2+2=?"}],
"max_tokens": 5,
"reasoning_effort": "none",
}).encode()
req = urllib.request.Request(
f"{OMNIROUTE_URL}/v1/chat/completions",
@@ -50,8 +51,13 @@ def check_model(model_id: str) -> tuple[bool, int | None, str | None, dict]:
resp = json.loads(r.read())
# Usage — до любой валидации контента.
usage = extract_usage(resp)
content = resp["choices"][0]["message"]["content"]
ok = bool(content.strip())
# HTTP 200 может содержать только reasoning и content=null.
# Это не успешный текстовый ответ и не ошибка Python.
choice = resp["choices"][0]
content = choice["message"].get("content")
ok = isinstance(content, str) and bool(content.strip())
if not ok:
error = f"Empty text response (finish_reason={choice.get('finish_reason')})"
except Exception as e:
error = f"{type(e).__name__}: {e}"
print(f" ✗ {model_id}: {error}", file=sys.stderr)