@xynogen/pix-models 0.2.7 → 0.2.8
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/package.json +1 -1
- package/src/models.ts +22 -3
package/package.json
CHANGED
package/src/models.ts
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
* Sorted by benchlm rank when available (best first), then alphabetical.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import {
|
|
12
|
+
type ExtensionAPI,
|
|
13
|
+
type ExtensionContext,
|
|
14
|
+
SettingsManager,
|
|
15
|
+
} from "@earendil-works/pi-coding-agent";
|
|
12
16
|
import {
|
|
13
17
|
fuzzyFilter,
|
|
14
18
|
Input,
|
|
@@ -574,8 +578,23 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
574
578
|
return;
|
|
575
579
|
}
|
|
576
580
|
const ok = await pi.setModel(picked);
|
|
577
|
-
if (ok)
|
|
578
|
-
|
|
581
|
+
if (!ok) {
|
|
582
|
+
ctx.ui.notify(`Failed to switch to ${picked.id}`, "error");
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const settings = SettingsManager.create(ctx.cwd);
|
|
587
|
+
settings.setDefaultModelAndProvider(picked.provider, picked.id);
|
|
588
|
+
await settings.flush();
|
|
589
|
+
const saveError = settings.drainErrors()[0];
|
|
590
|
+
if (saveError) {
|
|
591
|
+
ctx.ui.notify(
|
|
592
|
+
`Switched to ${picked.name ?? picked.id}, but failed to save the default: ${saveError.error.message}`,
|
|
593
|
+
"warning",
|
|
594
|
+
);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
ctx.ui.notify(`Default model: ${picked.provider}/${picked.id}`, "info");
|
|
579
598
|
}
|
|
580
599
|
|
|
581
600
|
export default function modelPickerExtension(pi: ExtensionAPI) {
|