Stop /api/system/status 500ing when Ollama is switched off
_ensure_client() returns None - not False - when USE_OLLAMA is false, because it returns before it ever probes. SystemStatusOut.ollama_connected is typed bool, so pydantic rejected the None and the endpoint answered 500 on exactly the configuration this deployment runs. Found by smoke-testing the live host: every other read route answered 200 and this one alone was a server error, which read like a database problem and was not one. "Ollama is off" now reports as ollama_connected: false. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,7 +87,13 @@ def get_system_status() -> SystemStatusOut:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ollama_ok = _ensure_client()
|
||||
# bool(), because _ensure_client() has three return values, not two: True and
|
||||
# False when Ollama is enabled and reachable/unreachable, and None when
|
||||
# USE_OLLAMA is false - it returns before it ever probes. ollama_connected is
|
||||
# typed bool, so that None failed response_model validation and turned the
|
||||
# whole endpoint into a 500 on exactly the configuration this deployment
|
||||
# runs (USE_OLLAMA=false). "Ollama is switched off" is not a server error.
|
||||
ollama_ok = bool(_ensure_client())
|
||||
dist_ok = FRONTEND_DIST.exists() and (FRONTEND_DIST / "index.html").exists()
|
||||
|
||||
return SystemStatusOut(
|
||||
|
||||
Reference in New Issue
Block a user