Diff
1diff --git a/index.ts b/index.ts
2index 2d77b843072766d747d799ee9c7147b29b02f10f..c0eb0dc076d6b73333209418bf442052042dc3ae 100644
3--- a/index.ts
4+++ b/index.ts
5@@ -212,10 +212,17 @@ export default async function (pi: ExtensionAPI) {
6 const controller = new AbortController();
7 const timer = setTimeout(() => controller.abort(), timeoutMs);
8 const propsUrl = `${baseUrl.replace(/\/v1$/, "")}/props?model=${encodeURIComponent(modelId)}&autoload=${autoload}`;
9+ const clearFooterStatusLater = () =>
10+ setTimeout(() => ctx?.ui.setStatus(PROVIDER_ID, undefined), 8000);
11
12 try {
13+ if (autoload && ctx) {
14+ ctx.ui.setStatus(PROVIDER_ID, ctx.ui.theme.fg("dim", `[llama.cpp] loading: ${modelId}`));
15+ }
16+
17 const response = await fetch(propsUrl, { signal: controller.signal });
18 if (!response.ok) {
19+ ctx?.ui.setStatus(PROVIDER_ID, undefined);
20 ctx?.ui.notify(`[llama-cpp] /props for ${modelId} returned ${response.status}`, "error");
21 return;
22 }
23@@ -224,14 +231,16 @@ export default async function (pi: ExtensionAPI) {
24 const errors = [...validatePropsResponse.Errors(data)]
25 .map((e) => `${"path" in e ? e.path : ""} ${e.message}`)
26 .join("; ");
27+ ctx?.ui.setStatus(PROVIDER_ID, undefined);
28 ctx?.ui.notify(`[llama-cpp] invalid /props response for ${modelId}: ${errors}`, "error");
29 return;
30 }
31 const nCtx = data.default_generation_settings?.n_ctx;
32 let updated = false;
33+ let loadedFooterStatus = autoload ? `[llama.cpp] ${modelId} loaded` : undefined;
34 if (typeof nCtx === "number" && nCtx > 0) {
35 model.contextWindow = nCtx;
36- ctx?.ui.notify(`[llama-cpp] contextWindow=${nCtx} for ${modelId}`, "info");
37+ loadedFooterStatus = `[llama.cpp] ${modelId} loaded with ctx ${nCtx} tokens`;
38 updated = true;
39 }
40 if (data.chat_template?.includes("enable_thinking") === true) {
41@@ -245,6 +254,10 @@ export default async function (pi: ExtensionAPI) {
42 updated = true;
43 }
44 discoveredMetadata.add(modelId);
45+ if (loadedFooterStatus && ctx) {
46+ ctx.ui.setStatus(PROVIDER_ID, ctx.ui.theme.fg("dim", loadedFooterStatus));
47+ clearFooterStatusLater();
48+ }
49 if (!updated) {
50 return;
51 }
52@@ -258,6 +271,7 @@ export default async function (pi: ExtensionAPI) {
53 } catch (error) {
54 const err = error as Error;
55 const msg = err.name === "AbortError" ? "timeout" : err.message;
56+ ctx?.ui.setStatus(PROVIDER_ID, undefined);
57 ctx?.ui.notify(`[llama-cpp] /props for ${modelId} failed: ${msg}`, "error");
58 } finally {
59 clearTimeout(timer);