feat(ollama): add availability check before model operations

Add `ensureOllamaAvailable` function to lib/ollama.ts for checking and waiting for Ollama server health with configurable timeout.

Integrate the check in GET /api/ollama/models route with 3s timeout to prevent UI blocking, and in POST /api/ollama/pull route with 20s timeout to ensure availability before pulling models.

Update ChatContainer to always render ModelDropdown for better UX when no model is selected.
This commit is contained in:
Evandro Fonseca Junior committed 2025-10-29 16:21:49 -03:00
1 parent f96d4ed696
commit 7b2386876a
12 files changed
+211 -20

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"predev": "tsx scripts/init-db.ts",
"predev": "powershell -ExecutionPolicy Bypass -File scripts/ensure-ollama.ps1 && tsx scripts/init-db.ts",
"prebuild": "tsx scripts/init-db.ts",
"dev": "next dev",
"build": "next build",