download-models, show actionable error message when Ollama is not running

This commit is contained in:
Yiorgis Gozadinos 2026-02-19 13:55:45 +02:00
parent 356e9f040d
commit 08a4252c33
No known key found for this signature in database
2 changed files with 33 additions and 26 deletions

View file

@ -4,6 +4,7 @@
### Fixed ### Fixed
- Added `cachetools` as an explicit dependency (was only available transitively, causing `ModuleNotFoundError` for some installations) - Added `cachetools` as an explicit dependency (was only available transitively, causing `ModuleNotFoundError` for some installations)
- **download-models**: Show actionable error message when Ollama is not running instead of cryptic "All connection attempts failed" (#277)
## [0.30.1] - 2026-02-17 ## [0.30.1] - 2026-02-17

View file

@ -1846,6 +1846,7 @@ class HaikuRAG:
base_url = self._config.providers.ollama.base_url base_url = self._config.providers.ollama.base_url
try:
async with httpx.AsyncClient(timeout=None) as client: async with httpx.AsyncClient(timeout=None) as client:
for model in sorted(required_models): for model in sorted(required_models):
yield DownloadProgress(model=model, status="pulling") yield DownloadProgress(model=model, status="pulling")
@ -1875,6 +1876,11 @@ class HaikuRAG:
pass pass
yield DownloadProgress(model=model, status="done") yield DownloadProgress(model=model, status="done")
except httpx.ConnectError:
raise ConnectionError(
f"Cannot connect to Ollama at {base_url}. "
"Is Ollama running? Start it with 'ollama serve'."
)
def close(self): def close(self):
"""Close the underlying store connection.""" """Close the underlying store connection."""