mirror of https://github.com/openclaw/openclaw.git
fix: preserve qualified provider prefix in Control UI model selector
When sessions report an already-qualified model id (e.g. ollama/qwen3:30b), resolveServerChatModelValue was re-qualifying it using modelProvider, producing incorrect values like openai-codex/qwen3:30b. Preserve already-qualified model refs as-is before applying provider prefix. Adds test coverage for qualified model preservation. Fixes #49839
This commit is contained in:
parent
1fcb2cfeb5
commit
683c028553
|
|
@ -29,6 +29,12 @@ describe("chat-model-ref helpers", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("preserves already-qualified model refs without prepending provider", () => {
|
||||
expect(resolveServerChatModelValue("ollama/qwen3:30b", "openai-codex")).toBe(
|
||||
"ollama/qwen3:30b",
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizes raw overrides when the catalog match is unique", () => {
|
||||
expect(normalizeChatModelOverrideValue(createChatModelOverride("gpt-5-mini"), catalog)).toBe(
|
||||
"openai/gpt-5-mini",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ export function buildQualifiedChatModelValue(model: string, provider?: string |
|
|||
if (!trimmedModel) {
|
||||
return "";
|
||||
}
|
||||
// Preserve already-qualified model refs (provider/model) as-is.
|
||||
// This avoids prepending an unrelated/default provider.
|
||||
if (trimmedModel.includes("/")) {
|
||||
return trimmedModel;
|
||||
}
|
||||
const trimmedProvider = provider?.trim();
|
||||
return trimmedProvider ? `${trimmedProvider}/${trimmedModel}` : trimmedModel;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue