fix(coding-agent): show llama download progress

This commit is contained in:
Mario Zechner
2026-07-21 14:25:10 +02:00
parent 109c4125d2
commit 864b35c462
4 changed files with 8 additions and 5 deletions
@@ -107,9 +107,11 @@ function parseLoadProgress(data: unknown): LlamaProgress | undefined {
function parseDownloadProgress(data: unknown): LlamaProgress | undefined {
if (typeof data !== "object" || data === null) return undefined;
const nested = (data as { progress?: unknown }).progress;
const files = typeof nested === "object" && nested !== null ? nested : data;
let done = 0;
let total = 0;
for (const value of Object.values(data as Record<string, unknown>)) {
for (const value of Object.values(files as Record<string, unknown>)) {
if (typeof value !== "object" || value === null) continue;
const entry = value as { done?: unknown; total?: unknown };
if (typeof entry.done !== "number" || typeof entry.total !== "number") continue;
@@ -88,7 +88,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
model: target.id,
initialMessage: "Starting…",
cancelTitle: "Stop loading?",
cancelMessage: `Stop loading ${target.id}?`,
cancelMessage: target.id,
run: (signal, update) => client.loadAndWait(target.id, update, signal),
cancel: () => client.unload(target.id),
});
@@ -119,7 +119,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
client: LlamaClient,
model: LlamaModelInfo,
): Promise<void> => {
if (!(await ui.confirm("Unload model?", `Unload ${model.id}?`))) return;
if (!(await ui.confirm("Unload model?", model.id))) return;
await client.unloadAndWait(model.id);
await syncCatalog(ctx, client);
ctx.ui.notify(`Unloaded ${model.id}`);
@@ -162,7 +162,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
model,
initialMessage: "Starting…",
cancelTitle: "Stop download?",
cancelMessage: `Stop downloading ${model}?`,
cancelMessage: model,
run: (signal, update) => client.downloadAndWait(model, update, signal),
cancel: () => client.unload(model),
});