mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(models): mark local Ollama rows available (#97491)
* fix(models): mark local Ollama rows available * fix(models): mark local Ollama rows available --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
co-authored by
Vincent Koc
parent
b580258e94
commit
a10add7531
@@ -56,4 +56,22 @@ describe("toModelRow", () => {
|
||||
expect(row.local).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps local provider rows available when registry availability omits the model key", () => {
|
||||
const row = toModelRow({
|
||||
model: {
|
||||
...OPENROUTER_MODEL,
|
||||
provider: "ollama",
|
||||
id: "qwen3.6:35b-a3b",
|
||||
name: "qwen3.6:35b-a3b",
|
||||
baseUrl: "http://127.0.0.1:11434",
|
||||
} as never,
|
||||
key: "ollama/qwen3.6:35b-a3b",
|
||||
tags: [],
|
||||
availableKeys: new Set(["ollama/llama3.2"]),
|
||||
});
|
||||
|
||||
expect(row.local).toBe(true);
|
||||
expect(row.available).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,8 +50,10 @@ export function toModelRow(params: {
|
||||
|
||||
const input = model.input.join("+") || "text";
|
||||
const local = isLocalBaseUrl(model.baseUrl ?? "");
|
||||
const modelIsAvailable = availableKeys?.has(modelKey(model.provider, model.id)) ?? false;
|
||||
// Prefer model-level registry availability when present.
|
||||
const modelIsAvailable =
|
||||
local || (availableKeys?.has(modelKey(model.provider, model.id)) ?? false);
|
||||
// Local provider rows use their baseUrl as the auth marker.
|
||||
// Otherwise prefer model-level registry availability when present.
|
||||
// Fall back to provider-level auth heuristics only if registry availability isn't available,
|
||||
// or if the caller marks this as a synthetic/forward-compat model that won't appear in getAvailable().
|
||||
const available =
|
||||
|
||||
Reference in New Issue
Block a user