fix: align AI check with OmniRoute validation
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-08 18:16:47 -06:00
parent cfb3e97760
commit 344a618237
1 changed files with 14 additions and 3 deletions

View File

@ -2895,8 +2895,7 @@ payload = {
"model": model,
"messages": [{"role": "user", "content": "Return only: ok"}],
"stream": False,
"max_tokens": 8,
"temperature": 0,
"max_tokens": 64,
}
headers = {"Content-Type": "application/json", "Accept": "application/json"}
if api_key:
@ -2919,7 +2918,19 @@ except Exception as exc:
choices = data.get("choices") or []
content = ""
if choices:
content = ((choices[0].get("message") or {}).get("content") or "").strip()
value = (choices[0].get("message") or {}).get("content")
if isinstance(value, str):
content = value.strip()
elif isinstance(value, list):
parts = []
for item in value:
if isinstance(item, str):
parts.append(item)
elif isinstance(item, dict):
text = item.get("text") or item.get("content")
if isinstance(text, str):
parts.append(text)
content = " ".join(parts).strip()
raise SystemExit(0 if content else 1)
PY
then