diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index 1a802ac..ae66ff2 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -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