feat: allow choose multiple models for some cli tools

This commit is contained in:
2026-07-19 22:16:57 +07:00
parent c9d17d3586
commit 5329a4bd67
6 changed files with 134 additions and 67 deletions
+7 -7
View File
@@ -47,24 +47,24 @@ describe("CLI tool configuration contract", () => {
apiKeyId: null,
opencodeModels: ["cc/a", "cc/a", "cx/b"],
opencodeDefaultModel: "missing/model",
})).toMatchObject({ opencodeModels: ["cc/a", "cx/b"], opencodeDefaultModel: "cc/a" });
})).toMatchObject({ opencodeModels: ["cc/a", "cc/a", "cx/b"], opencodeDefaultModel: "cc/a" });
expect(normalizeCliToolConfig("cowork", {
baseUrl: "https://router.example",
apiKeyMode: "managed",
selectedModels: ["cc/a"],
selectedModels: ["cc/a", "cc/a"],
coworkThinking: { "cc/a": "high", "stale/model": "low" },
})).toMatchObject({ selectedModels: ["cc/a"], coworkThinking: { "cc/a": "high" } });
})).toMatchObject({ selectedModels: ["cc/a", "cc/a"], coworkThinking: { "cc/a": "high" } });
expect(normalizeCliToolConfig("cursor", {
apiKeyMode: "managed",
apiKeyId: "key-1",
selectedModels: ["cc/a", "cx/b"],
})).toEqual({ apiKeyMode: "managed", apiKeyId: "key-1", selectedModels: ["cc/a", "cx/b"] });
selectedModels: ["cc/a", "cc/a", "cx/b"],
})).toEqual({ apiKeyMode: "managed", apiKeyId: "key-1", selectedModels: ["cc/a", "cc/a", "cx/b"] });
expect(normalizeCliToolConfig("copilot", {
baseUrl: "https://router.example/v1",
selectedModels: ["cc/a"],
selectedModels: ["cc/a", "cc/a"],
copilotThinking: { "cc/a": "high", "stale/model": "low" },
copilotTokens: {
"cc/a": { maxInputTokens: 100000, maxOutputTokens: 32000 },
@@ -72,7 +72,7 @@ describe("CLI tool configuration contract", () => {
},
})).toEqual({
baseUrl: "https://router.example/v1",
selectedModels: ["cc/a"],
selectedModels: ["cc/a", "cc/a"],
copilotThinking: { "cc/a": "high" },
copilotTokens: { "cc/a": { maxInputTokens: 100000, maxOutputTokens: 32000 } },
});
+1 -1
View File
@@ -74,7 +74,7 @@ describe("permanent model deletion", () => {
});
await db.upsertCliToolConfig(cliUser.id, "cowork", {
baseUrl: "http://127.0.0.1:20127",
selectedModels: ["deleted-alias", `${providerPrefix}/gpt-keep`],
selectedModels: ["deleted-alias", "deleted-alias", `${providerPrefix}/gpt-keep`],
coworkThinking: { "deleted-alias": "high", [`${providerPrefix}/gpt-keep`]: "low" },
});