fix(coding-agent): show llama download progress
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed llama.cpp router download progress updates and removed redundant wording from model action confirmations.
|
||||||
- Moved automatic model catalog network refresh out of startup initialization and into the running interactive and RPC modes.
|
- Moved automatic model catalog network refresh out of startup initialization and into the running interactive and RPC modes.
|
||||||
- Fixed persisted sessions being read and parsed twice when opened, reducing startup latency for large sessions ([#6793](https://github.com/earendil-works/pi/issues/6793)).
|
- Fixed persisted sessions being read and parsed twice when opened, reducing startup latency for large sessions ([#6793](https://github.com/earendil-works/pi/issues/6793)).
|
||||||
- Fixed prompt-template defaults for all arguments (`${@:-default}` and `${ARGUMENTS:-default}`) ([#6695](https://github.com/earendil-works/pi/issues/6695)).
|
- Fixed prompt-template defaults for all arguments (`${@:-default}` and `${ARGUMENTS:-default}`) ([#6695](https://github.com/earendil-works/pi/issues/6695)).
|
||||||
|
|||||||
@@ -107,9 +107,11 @@ function parseLoadProgress(data: unknown): LlamaProgress | undefined {
|
|||||||
|
|
||||||
function parseDownloadProgress(data: unknown): LlamaProgress | undefined {
|
function parseDownloadProgress(data: unknown): LlamaProgress | undefined {
|
||||||
if (typeof data !== "object" || data === null) return 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 done = 0;
|
||||||
let total = 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;
|
if (typeof value !== "object" || value === null) continue;
|
||||||
const entry = value as { done?: unknown; total?: unknown };
|
const entry = value as { done?: unknown; total?: unknown };
|
||||||
if (typeof entry.done !== "number" || typeof entry.total !== "number") continue;
|
if (typeof entry.done !== "number" || typeof entry.total !== "number") continue;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
|
|||||||
model: target.id,
|
model: target.id,
|
||||||
initialMessage: "Starting…",
|
initialMessage: "Starting…",
|
||||||
cancelTitle: "Stop loading?",
|
cancelTitle: "Stop loading?",
|
||||||
cancelMessage: `Stop loading ${target.id}?`,
|
cancelMessage: target.id,
|
||||||
run: (signal, update) => client.loadAndWait(target.id, update, signal),
|
run: (signal, update) => client.loadAndWait(target.id, update, signal),
|
||||||
cancel: () => client.unload(target.id),
|
cancel: () => client.unload(target.id),
|
||||||
});
|
});
|
||||||
@@ -119,7 +119,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
|
|||||||
client: LlamaClient,
|
client: LlamaClient,
|
||||||
model: LlamaModelInfo,
|
model: LlamaModelInfo,
|
||||||
): Promise<void> => {
|
): 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 client.unloadAndWait(model.id);
|
||||||
await syncCatalog(ctx, client);
|
await syncCatalog(ctx, client);
|
||||||
ctx.ui.notify(`Unloaded ${model.id}`);
|
ctx.ui.notify(`Unloaded ${model.id}`);
|
||||||
@@ -162,7 +162,7 @@ export default function llamaExtension(pi: ExtensionAPI): void {
|
|||||||
model,
|
model,
|
||||||
initialMessage: "Starting…",
|
initialMessage: "Starting…",
|
||||||
cancelTitle: "Stop download?",
|
cancelTitle: "Stop download?",
|
||||||
cancelMessage: `Stop downloading ${model}?`,
|
cancelMessage: model,
|
||||||
run: (signal, update) => client.downloadAndWait(model, update, signal),
|
run: (signal, update) => client.downloadAndWait(model, update, signal),
|
||||||
cancel: () => client.unload(model),
|
cancel: () => client.unload(model),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ describe("llama.cpp extension", () => {
|
|||||||
send({
|
send({
|
||||||
model: "owner/repo:Q4_K_M",
|
model: "owner/repo:Q4_K_M",
|
||||||
event: "download_progress",
|
event: "download_progress",
|
||||||
data: { "https://example/model.gguf": { done: 512, total: 1024 } },
|
data: { progress: { "https://example/model.gguf": { done: 512, total: 1024 } } },
|
||||||
});
|
});
|
||||||
status = "unloaded";
|
status = "unloaded";
|
||||||
send({ model: "owner/repo:Q4_K_M", event: "download_finished", data: {} });
|
send({ model: "owner/repo:Q4_K_M", event: "download_finished", data: {} });
|
||||||
|
|||||||
Reference in New Issue
Block a user