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:
@@ -1,6 +1,6 @@
|
||||
import { ref, computed } from "vue";
|
||||
import { defineStore } from "pinia";
|
||||
import { apiGet, apiPut, apiPost } from "@/api/client";
|
||||
import { apiGet, apiPut, apiPost, apiStreamPost } from "@/api/client";
|
||||
import type { AppSettings } from "@/types/settings";
|
||||
|
||||
export const useSettingsStore = defineStore("settings", () => {
|
||||
@@ -45,8 +45,13 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function pullModel(model: string) {
|
||||
await apiPost("/api/chat/models/pull", { model });
|
||||
async function pullModel(
|
||||
model: string,
|
||||
onProgress?: (data: Record<string, unknown>) => void,
|
||||
) {
|
||||
await apiStreamPost("/api/chat/models/pull", { model }, (data) => {
|
||||
if (onProgress) onProgress(data);
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteModel(model: string) {
|
||||
|
||||
Reference in New Issue
Block a user