fix: update the logic to update thinking in cli tools page

This commit is contained in:
2026-07-20 10:14:02 +07:00
parent 5329a4bd67
commit cb0807fe74
5 changed files with 170 additions and 97 deletions
+31 -3
View File
@@ -54,7 +54,10 @@ describe("CLI tool configuration contract", () => {
apiKeyMode: "managed",
selectedModels: ["cc/a", "cc/a"],
coworkThinking: { "cc/a": "high", "stale/model": "low" },
})).toMatchObject({ selectedModels: ["cc/a", "cc/a"], coworkThinking: { "cc/a": "high" } });
})).toMatchObject({
selectedModels: ["cc/a", "cc/a"],
coworkModelSettings: [{ thinking: "high" }, { thinking: "high" }],
});
expect(normalizeCliToolConfig("cursor", {
apiKeyMode: "managed",
@@ -73,11 +76,36 @@ describe("CLI tool configuration contract", () => {
})).toEqual({
baseUrl: "https://router.example/v1",
selectedModels: ["cc/a", "cc/a"],
copilotThinking: { "cc/a": "high" },
copilotTokens: { "cc/a": { maxInputTokens: 100000, maxOutputTokens: 32000 } },
copilotModelSettings: [
{ thinking: "high", tokens: { maxInputTokens: 100000, maxOutputTokens: 32000 } },
{ thinking: "high", tokens: { maxInputTokens: 100000, maxOutputTokens: 32000 } },
],
});
});
it("keeps duplicate model settings independent by occurrence", () => {
expect(normalizeCliToolConfig("copilot", {
baseUrl: "https://router.example/v1",
selectedModels: ["cc/a", "cc/a"],
copilotModelSettings: [
{ thinking: "low", tokens: { maxInputTokens: 16000 } },
{ thinking: "high", tokens: { maxOutputTokens: 32000 } },
],
})).toMatchObject({
copilotModelSettings: [
{ thinking: "low", tokens: { maxInputTokens: 16000 } },
{ thinking: "high", tokens: { maxOutputTokens: 32000 } },
],
});
expect(normalizeCliToolConfig("cowork", {
baseUrl: "https://router.example",
apiKeyMode: "managed",
selectedModels: ["cc/a", "cc/a"],
coworkModelSettings: [{ thinking: "low" }, { thinking: "high" }],
})).toMatchObject({ coworkModelSettings: [{ thinking: "low" }, { thinking: "high" }] });
});
it("rejects plaintext secrets, invalid URLs, and invalid token limits", () => {
expect(() => normalizeCliToolConfig("claude", {
baseUrl: "https://router.example",
+1 -1
View File
@@ -161,7 +161,7 @@ describe("permanent model deletion", () => {
});
expect((await db.getCliToolConfig(cliUser.id, "cowork")).config).toMatchObject({
selectedModels: [`${providerPrefix}/gpt-keep`],
coworkThinking: { [`${providerPrefix}/gpt-keep`]: "low" },
coworkModelSettings: [{ thinking: "low" }],
});
const history = await db.getUsageHistory({});