fix(library-desk): reduce ollama health check to single API call

Previously called /api/tags twice (once for server check, once for
model check). Now reuses response from single call.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-10 22:31:07 +01:00
co-authored by Claude Opus 4.5
parent c91f77bf28
commit 4cc2002fa6
@@ -298,13 +298,22 @@ class OllamaClient:
True if healthy, False otherwise
"""
try:
# Check server is up
# Check server is up and get models in one call
response = await self.client.get(self.tags_url, timeout=5.0)
response.raise_for_status()
data = response.json()
models = data.get("models", [])
# Check model is available
models_available = await self.check_model_available()
if not models_available:
check_model = self.model
model_found = False
for m in models:
name = m.get("name", "")
if name == check_model or name.startswith(f"{check_model}:"):
model_found = True
break
if not model_found:
logger.warning(f"Model '{self.model}' not found in Ollama")
return False