hotfix(ollama): Show only Ollama models after provider selection (#55290)

* Fix: Add ollama to NON_PI_NATIVE_MODEL_PROVIDERS to ensure correct model selection

* Add test coverage for ollama provider to ensure models are merged correctly

* Fix test case for ollama provider by adding required model properties

* Changelog: add Ollama model picker fix

* Changelog: move Ollama fix entry to section tail

---------

Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
This commit is contained in:
Mingxuan
2026-04-01 07:48:22 +08:00
committed by GitHub
parent bea53d7a3f
commit 302c047d86
3 changed files with 34 additions and 1 deletions

View File

@@ -285,6 +285,38 @@ describe("loadModelCatalog", () => {
);
});
it("merges configured models for opted-in ollama provider", async () => {
mockSingleOpenAiCatalogModel();
const result = await loadModelCatalog({
config: {
models: {
providers: {
ollama: {
baseUrl: "http://127.0.0.1:11434",
api: "ollama",
models: [
{
id: "llama3.2",
name: "Llama 3.2",
reasoning: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1048576,
maxTokens: 65536,
},
],
},
},
},
} as OpenClawConfig,
});
expect(result).toContainEqual(
expect.objectContaining({ provider: "ollama", id: "llama3.2", name: "Llama 3.2" }),
);
});
it("does not merge configured models for providers that are not opted in", async () => {
mockSingleOpenAiCatalogModel();

View File

@@ -44,7 +44,7 @@ const defaultImportPiSdk = () => import("./pi-model-discovery-runtime.js");
let importPiSdk = defaultImportPiSdk;
let modelSuppressionPromise: Promise<typeof import("./model-suppression.runtime.js")> | undefined;
const NON_PI_NATIVE_MODEL_PROVIDERS = new Set(["deepseek", "kilocode"]);
const NON_PI_NATIVE_MODEL_PROVIDERS = new Set(["deepseek", "kilocode", "ollama"]);
function shouldLogModelCatalogTiming(): boolean {
return process.env.OPENCLAW_DEBUG_INGRESS_TIMING === "1";