Stream model pull progress via SSE instead of fire-and-forget
Replace the asyncio.create_task() fire-and-forget pattern for model downloads with SSE streaming that relays Ollama's pull progress in real time. The frontend now shows live download percentage instead of a static "Pulling..." label with blind polling. - routes/chat.py: SSE streaming endpoint with 1800s timeout - stores/settings.ts: pullModel uses apiStreamPost with onProgress callback - SettingsView.vue: live "Downloading 42%" display, removed polling/setTimeout - summary.md: updated to reflect SSE streaming for model pulls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-7
@@ -66,9 +66,10 @@ for AI-assisted features.
|
||||
simple word splitting with stopword filtering (no embeddings).
|
||||
- **No blocking long-running operations:** Any potentially slow operation (model
|
||||
pulls, LLM calls, URL fetching, etc.) must never block app startup or freeze the
|
||||
UI. Backend uses `asyncio.create_task()` for fire-and-forget work and SSE streaming
|
||||
for incremental responses. Frontend keeps the UI responsive during async operations
|
||||
(loading states, streaming indicators). This applies to all future features as well.
|
||||
UI. Backend uses SSE streaming for incremental responses (chat messages and model
|
||||
pull progress). Frontend keeps the UI responsive during async operations (loading
|
||||
states, streaming indicators, progress percentages). This applies to all future
|
||||
features as well.
|
||||
- **Auto-pull model on startup:** Non-blocking background task, logs warning on
|
||||
failure so the app still starts even if Ollama isn't ready.
|
||||
- **Backlinks:** `GET /api/notes/:id/backlinks` searches all note bodies for
|
||||
@@ -209,7 +210,7 @@ fabledassistant/
|
||||
│ │ ├── notes.ts # CRUD + tag filter, resolveTitle, convertToTask, convertToNote, fetchBacklinks, fetchAllTags
|
||||
│ │ ├── tasks.ts # CRUD + status/priority filter, patchStatus (uses body not description)
|
||||
│ │ ├── chat.ts # Conversation CRUD, sendMessage (SSE streaming), saveMessageAsNote, summarizeAsNote, fetchModels, status polling (ollamaStatus, modelStatus, chatReady)
|
||||
│ │ ├── settings.ts # App settings: assistantName, defaultModel, fetchInstalledModels, pullModel, deleteModel
|
||||
│ │ ├── settings.ts # App settings: assistantName, defaultModel, fetchInstalledModels, pullModel (SSE streaming with onProgress callback), deleteModel
|
||||
│ │ └── toast.ts # Toast notification state, 3s auto-dismiss
|
||||
│ ├── types/
|
||||
│ │ ├── note.ts # Note interface (with status, priority, due_date, is_task) + TaskStatus, TaskPriority types + NoteListResponse
|
||||
@@ -279,7 +280,7 @@ fabledassistant/
|
||||
| POST | `/api/chat/conversations/:id/summarize` | Summarize conversation via LLM, save as note |
|
||||
| GET | `/api/chat/status` | Check Ollama availability and model readiness (`{ollama, model, default_model}`) |
|
||||
| GET | `/api/chat/models` | List available Ollama models |
|
||||
| POST | `/api/chat/models/pull` | Pull/download a model from Ollama (background, body: `{model}`) |
|
||||
| POST | `/api/chat/models/pull` | Pull/download a model from Ollama via SSE streaming progress (body: `{model}`, response: SSE with `{status, completed, total}` events) |
|
||||
| POST | `/api/chat/models/delete` | Delete a model from Ollama (body: `{model}`) |
|
||||
| GET | `/api/settings` | Get all app settings as `{key: value}` dict |
|
||||
| PUT | `/api/settings` | Update settings (body: `{key: value, ...}`) |
|
||||
@@ -441,7 +442,7 @@ When adding a new migration, follow these conventions:
|
||||
- [x] **Configurable assistant name:** Default "Fable", editable in settings, injected into LLM system prompt and chat message labels
|
||||
- [x] **Settings page:** `/settings` route with assistant name form + model catalog
|
||||
- [x] **Model catalog:** 18 models across 3 categories (General Purpose, Coding, Uncensored / Creative Writing) with descriptions, sizes, and best-for labels
|
||||
- [x] **Model management:** Download (pull), select (set as default), and remove (delete from Ollama) with confirmation UI
|
||||
- [x] **Model management:** Download (pull with SSE progress streaming + live percentage in UI), select (set as default), and remove (delete from Ollama) with confirmation UI
|
||||
- [x] **Status indicator in nav bar:** Moved from per-component (ChatView/ChatPanel) to global AppHeader; green/yellow/red dot with label
|
||||
- [x] **Chat bubble layout:** User messages right-aligned (primary color bg), assistant messages left-aligned (card bg), speech bubble tails
|
||||
- [x] **Floating dark input bar:** `#1c1c1e` background, rounded corners, circular send button with arrow
|
||||
@@ -485,7 +486,7 @@ When adding a new migration, follow these conventions:
|
||||
- Dedicated `/chat` page with bubble-style messages (user right, assistant left), floating dark input bar
|
||||
- Slide-out chat panel accessible from any page, auto-includes note/task context
|
||||
- Settings page: configurable assistant name (default "Fable"), model catalog with 18 models in 3 categories
|
||||
- Model management: download, select, and remove models from the settings page
|
||||
- Model management: download (with live SSE progress percentage), select, and remove models from the settings page
|
||||
- Ollama status indicator in global nav bar (green/yellow/red dot) with 30s polling
|
||||
- Recent chats section on home page with quick "New Chat" button
|
||||
- HTML entity rendering fix (apostrophes in marked → DOMPurify pipeline)
|
||||
|
||||
Reference in New Issue
Block a user