darkfoo-code 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +54 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2517,7 +2517,7 @@ function Banner({ model, cwd, providerName, providerOnline }) {
|
|
|
2517
2517
|
] }),
|
|
2518
2518
|
/* @__PURE__ */ jsxs2(Box2, { marginTop: 1, marginLeft: 2, children: [
|
|
2519
2519
|
/* @__PURE__ */ jsx3(Text2, { color: theme.dim ?? "#7e8ea6", children: "model " }),
|
|
2520
|
-
/* @__PURE__ */ jsx3(Text2, { color: theme.cyan ?? "#5eead4", bold: true, children: model })
|
|
2520
|
+
model ? /* @__PURE__ */ jsx3(Text2, { color: theme.cyan ?? "#5eead4", bold: true, children: model }) : /* @__PURE__ */ jsx3(Text2, { color: theme.dim ?? "#7e8ea6", children: "--" })
|
|
2521
2521
|
] }),
|
|
2522
2522
|
/* @__PURE__ */ jsxs2(Box2, { marginLeft: 2, children: [
|
|
2523
2523
|
/* @__PURE__ */ jsx3(Text2, { color: theme.dim ?? "#7e8ea6", children: "via " }),
|
|
@@ -2715,7 +2715,7 @@ function StatusLine({ model, messageCount, tokenEstimate, isStreaming }) {
|
|
|
2715
2715
|
"\u2500".repeat(2),
|
|
2716
2716
|
" "
|
|
2717
2717
|
] }),
|
|
2718
|
-
/* @__PURE__ */ jsx6(Text5, { color: theme.cyan, bold: true, children: model.split(":")[0] }),
|
|
2718
|
+
/* @__PURE__ */ jsx6(Text5, { color: theme.cyan, bold: true, children: model ? model.split(":")[0] : "--" }),
|
|
2719
2719
|
/* @__PURE__ */ jsx6(Text5, { color: theme.dim, children: " \u2502 " }),
|
|
2720
2720
|
/* @__PURE__ */ jsxs5(Text5, { color: theme.dim, children: [
|
|
2721
2721
|
messageCount,
|
|
@@ -3944,8 +3944,37 @@ function REPL({ initialPrompt }) {
|
|
|
3944
3944
|
}
|
|
3945
3945
|
}, []);
|
|
3946
3946
|
useEffect2(() => {
|
|
3947
|
-
|
|
3948
|
-
|
|
3947
|
+
const provider = getProvider();
|
|
3948
|
+
provider.healthCheck().then((ok) => {
|
|
3949
|
+
setProviderOnline(ok);
|
|
3950
|
+
if (!ok) {
|
|
3951
|
+
setModel("");
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3954
|
+
provider.listModels().then((models) => {
|
|
3955
|
+
if (models.length === 0) {
|
|
3956
|
+
setModel("");
|
|
3957
|
+
return;
|
|
3958
|
+
}
|
|
3959
|
+
const requested = model.toLowerCase();
|
|
3960
|
+
const match = models.find((m) => m.name.toLowerCase() === requested);
|
|
3961
|
+
if (match) {
|
|
3962
|
+
setModel(match.name);
|
|
3963
|
+
return;
|
|
3964
|
+
}
|
|
3965
|
+
const preferred = models.find((m) => m.name.includes("llama3.1")) ?? models.find((m) => m.name.includes("qwen")) ?? models.find((m) => m.name.includes("instruct")) ?? models[0];
|
|
3966
|
+
if (preferred) {
|
|
3967
|
+
setModel(preferred.name);
|
|
3968
|
+
setCommandOutput(`Model "${model}" not found. Using ${preferred.name} instead.`);
|
|
3969
|
+
} else {
|
|
3970
|
+
setModel("");
|
|
3971
|
+
}
|
|
3972
|
+
}).catch(() => setModel(""));
|
|
3973
|
+
}).catch(() => {
|
|
3974
|
+
setProviderOnline(false);
|
|
3975
|
+
setModel("");
|
|
3976
|
+
});
|
|
3977
|
+
}, []);
|
|
3949
3978
|
const commandContext = {
|
|
3950
3979
|
messages,
|
|
3951
3980
|
model,
|
|
@@ -4214,6 +4243,25 @@ program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assista
|
|
|
4214
4243
|
process.exit(1);
|
|
4215
4244
|
}
|
|
4216
4245
|
}
|
|
4246
|
+
const { getProvider: getProvider2 } = await Promise.resolve().then(() => (init_providers(), providers_exports));
|
|
4247
|
+
let resolvedModel = "";
|
|
4248
|
+
try {
|
|
4249
|
+
const models = await getProvider2().listModels();
|
|
4250
|
+
if (models.length > 0) {
|
|
4251
|
+
const match = models.find((m) => m.name.toLowerCase() === model.toLowerCase());
|
|
4252
|
+
if (match) {
|
|
4253
|
+
resolvedModel = match.name;
|
|
4254
|
+
} else {
|
|
4255
|
+
const fallback = models.find((m) => m.name.includes("llama3.1")) ?? models.find((m) => m.name.includes("qwen")) ?? models[0];
|
|
4256
|
+
if (fallback) {
|
|
4257
|
+
process.stderr.write(`Model "${model}" not found. Using ${fallback.name}
|
|
4258
|
+
`);
|
|
4259
|
+
resolvedModel = fallback.name;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
} catch {
|
|
4264
|
+
}
|
|
4217
4265
|
if (prompt) {
|
|
4218
4266
|
const { buildSystemPrompt: buildSystemPrompt2 } = await Promise.resolve().then(() => (init_system_prompt(), system_prompt_exports));
|
|
4219
4267
|
const { getTools: getTools2 } = await Promise.resolve().then(() => (init_tools(), tools_exports));
|
|
@@ -4233,7 +4281,7 @@ program.name("darkfoo").description("Darkfoo Code \u2014 local AI coding assista
|
|
|
4233
4281
|
process.exit(0);
|
|
4234
4282
|
});
|
|
4235
4283
|
for await (const event of query2({
|
|
4236
|
-
model,
|
|
4284
|
+
model: resolvedModel,
|
|
4237
4285
|
messages: [userMsg],
|
|
4238
4286
|
tools,
|
|
4239
4287
|
systemPrompt: sysPrompt,
|
|
@@ -4261,7 +4309,7 @@ Error: ${event.error}
|
|
|
4261
4309
|
process.exit(0);
|
|
4262
4310
|
}
|
|
4263
4311
|
const { waitUntilExit } = render(
|
|
4264
|
-
/* @__PURE__ */ jsx9(App, { model, systemPromptOverride: systemPrompt, children: /* @__PURE__ */ jsx9(REPL, {}) })
|
|
4312
|
+
/* @__PURE__ */ jsx9(App, { model: resolvedModel, systemPromptOverride: systemPrompt, children: /* @__PURE__ */ jsx9(REPL, {}) })
|
|
4265
4313
|
);
|
|
4266
4314
|
await waitUntilExit();
|
|
4267
4315
|
});
|