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:
qingminlong
2026-06-28 10:53:15 -07:00
committed by GitHub
co-authored by Vincent Koc
parent b580258e94
commit a10add7531
2 changed files with 22 additions and 2 deletions
@@ -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);
});
});
+4 -2
View File
@@ -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 =