mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 14:50:21 +00:00
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:
@@ -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();
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user