fix: model picker allowlist fallbacks

This commit is contained in:
Peter Steinberger
2026-01-21 11:22:23 +00:00
parent 884211a924
commit fb164b321e
6 changed files with 97 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ describe("directive behavior", () => {
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});
it("uses configured models when no allowlist is set", async () => {
it("includes catalog models when no allowlist is set", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
vi.mocked(loadModelCatalog).mockResolvedValueOnce([
@@ -153,7 +153,7 @@ describe("directive behavior", () => {
expect(text).toContain("anthropic/claude-opus-4-5");
expect(text).toContain("openai/gpt-4.1-mini");
expect(text).toContain("minimax/MiniMax-M2.1");
expect(text).not.toContain("xai/grok-4");
expect(text).toContain("xai/grok-4");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});

View File

@@ -101,6 +101,13 @@ function buildModelPickerCatalog(params: {
const hasAllowlist = Object.keys(params.cfg.agents?.defaults?.models ?? {}).length > 0;
if (!hasAllowlist) {
for (const entry of params.allowedModelCatalog) {
push({
provider: entry.provider,
id: entry.id ?? "",
name: entry.name,
});
}
for (const entry of buildConfiguredCatalog()) {
push(entry);
}