Merge c58de43f35af54f59ed9a99d6123b395e563a874 into 5e417b44e1540f528d2ae63e3e20229a902d1db2

This commit is contained in:
Cypherm 2026-03-21 02:39:10 +00:00 committed by GitHub
commit 8e32cd05a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View File

@ -47,4 +47,16 @@ describe("chat-model-ref helpers", () => {
expect(resolveServerChatModelValue("gpt-5-mini", "openai")).toBe("openai/gpt-5-mini");
expect(resolveServerChatModelValue("alias-only", null)).toBe("alias-only");
});
it("does not double-qualify already-qualified model values", () => {
expect(resolveServerChatModelValue("ollama/gpt-oss:120b-cloud", "anthropic")).toBe(
"ollama/gpt-oss:120b-cloud",
);
});
it("preserves nested vendor/model identifiers", () => {
expect(
resolveServerChatModelValue("openrouter/anthropic/claude-sonnet-4-6", "openrouter"),
).toBe("openrouter/anthropic/claude-sonnet-4-6");
});
});

View File

@ -15,6 +15,11 @@ export function buildQualifiedChatModelValue(model: string, provider?: string |
if (!trimmedModel) {
return "";
}
// If the model string already contains "/" it is already provider-qualified
// (e.g. "ollama/gpt-oss:120b-cloud"); return as-is to avoid double-qualifying.
if (trimmedModel.includes("/")) {
return trimmedModel;
}
const trimmedProvider = provider?.trim();
return trimmedProvider ? `${trimmedProvider}/${trimmedModel}` : trimmedModel;
}

View File

@ -41,6 +41,7 @@ export default defineConfig({
"src/**/*.test.ts",
"extensions/**/*.test.ts",
"test/**/*.test.ts",
"ui/src/ui/chat-model-ref.test.ts",
"ui/src/ui/app-chat.test.ts",
"ui/src/ui/views/agents-utils.test.ts",
"ui/src/ui/views/chat.test.ts",