fix(models): mark local Ollama rows available (#97491) · openclaw/openclaw@a10add7
qingminglong
·
2026-06-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,4 +56,22 @@ describe("toModelRow", () => {
|
56 | 56 | expect(row.local).toBe(true); |
57 | 57 | } |
58 | 58 | }); |
| 59 | + |
| 60 | +it("keeps local provider rows available when registry availability omits the model key", () => { |
| 61 | +const row = toModelRow({ |
| 62 | +model: { |
| 63 | + ...OPENROUTER_MODEL, |
| 64 | +provider: "ollama", |
| 65 | +id: "qwen3.6:35b-a3b", |
| 66 | +name: "qwen3.6:35b-a3b", |
| 67 | +baseUrl: "http://127.0.0.1:11434", |
| 68 | +} as never, |
| 69 | +key: "ollama/qwen3.6:35b-a3b", |
| 70 | +tags: [], |
| 71 | +availableKeys: new Set(["ollama/llama3.2"]), |
| 72 | +}); |
| 73 | + |
| 74 | +expect(row.local).toBe(true); |
| 75 | +expect(row.available).toBe(true); |
| 76 | +}); |
59 | 77 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -50,8 +50,10 @@ export function toModelRow(params: {
|
50 | 50 | |
51 | 51 | const input = model.input.join("+") || "text"; |
52 | 52 | const local = isLocalBaseUrl(model.baseUrl ?? ""); |
53 | | -const modelIsAvailable = availableKeys?.has(modelKey(model.provider, model.id)) ?? false; |
54 | | -// Prefer model-level registry availability when present. |
| 53 | +const modelIsAvailable = |
| 54 | +local || (availableKeys?.has(modelKey(model.provider, model.id)) ?? false); |
| 55 | +// Local provider rows use their baseUrl as the auth marker. |
| 56 | +// Otherwise prefer model-level registry availability when present. |
55 | 57 | // Fall back to provider-level auth heuristics only if registry availability isn't available, |
56 | 58 | // or if the caller marks this as a synthetic/forward-compat model that won't appear in getAvailable(). |
57 | 59 | const available = |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。