惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ollama): resolve cloud models omitted from tags · ope...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -20,6 +20,21 @@ const promptAndConfigureOllamaMock = vi.hoisted(() =>

2020

);

2121

const ensureOllamaModelPulledMock = vi.hoisted(() => vi.fn(async () => {}));

2222

const buildOllamaProviderMock = vi.hoisted(() => vi.fn());

23+

const queryOllamaModelShowInfoMock = vi.hoisted(() => vi.fn());

24+

const buildOllamaModelDefinitionMock = vi.hoisted(() =>

25+

vi.fn((modelId: string, contextWindow?: number, capabilities?: string[]) => ({

26+

id: modelId,

27+

name: modelId,

28+

reasoning: capabilities?.includes("thinking") ?? false,

29+

input: capabilities?.includes("vision") ? ["text", "image"] : ["text"],

30+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

31+

contextWindow: contextWindow ?? 8192,

32+

maxTokens: 8192,

33+

compat: capabilities

34+

? { supportsTools: capabilities.includes("tools"), supportsUsageInStreaming: true }

35+

: { supportsUsageInStreaming: true },

36+

})),

37+

);

2338

const createConfiguredOllamaStreamFnMock = vi.hoisted(() =>

2439

vi.fn((_params: { model: unknown; providerBaseUrl?: string }) => ({}) as never),

2540

);

@@ -29,6 +44,8 @@ vi.mock("./api.js", () => ({

2944

ensureOllamaModelPulled: ensureOllamaModelPulledMock,

3045

configureOllamaNonInteractive: vi.fn(),

3146

buildOllamaProvider: buildOllamaProviderMock,

47+

queryOllamaModelShowInfo: queryOllamaModelShowInfoMock,

48+

buildOllamaModelDefinition: buildOllamaModelDefinitionMock,

3249

}));

33503451

vi.mock("./src/stream.js", async (importOriginal) => {

@@ -43,6 +60,8 @@ beforeEach(() => {

4360

promptAndConfigureOllamaMock.mockClear();

4461

ensureOllamaModelPulledMock.mockClear();

4562

buildOllamaProviderMock.mockReset();

63+

queryOllamaModelShowInfoMock.mockReset();

64+

buildOllamaModelDefinitionMock.mockClear();

4665

createConfiguredOllamaStreamFnMock.mockClear();

4766

});

4867

@@ -420,6 +439,102 @@ describe("ollama plugin", () => {

420439

}

421440

});

422441442+

it("resolves requested Ollama cloud models that are omitted from tags but confirmed by show", async () => {

443+

const provider = registerProvider();

444+

const previous = process.env.OLLAMA_API_KEY;

445+

process.env.OLLAMA_API_KEY = "ollama-local";

446+

buildOllamaProviderMock.mockResolvedValueOnce({

447+

baseUrl: "http://127.0.0.1:11434",

448+

api: "ollama",

449+

models: [

450+

{

451+

id: "kimi-k2.5:cloud",

452+

name: "kimi-k2.5:cloud",

453+

reasoning: true,

454+

input: ["text"],

455+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

456+

contextWindow: 262144,

457+

maxTokens: 8192,

458+

},

459+

],

460+

});

461+

queryOllamaModelShowInfoMock.mockResolvedValueOnce({

462+

contextWindow: 1048576,

463+

capabilities: ["completion", "tools", "thinking"],

464+

});

465+466+

try {

467+

await provider.prepareDynamicModel?.({

468+

config: {},

469+

provider: "ollama",

470+

modelId: "deepseek-v4-pro:cloud",

471+

modelRegistry: { find: vi.fn(() => null) },

472+

} as never);

473+474+

expect(queryOllamaModelShowInfoMock).toHaveBeenCalledWith(

475+

"http://127.0.0.1:11434",

476+

"deepseek-v4-pro:cloud",

477+

);

478+

expect(

479+

provider.resolveDynamicModel?.({

480+

config: {},

481+

provider: "ollama",

482+

modelId: "deepseek-v4-pro:cloud",

483+

modelRegistry: { find: vi.fn(() => null) },

484+

} as never),

485+

).toMatchObject({

486+

provider: "ollama",

487+

id: "deepseek-v4-pro:cloud",

488+

api: "ollama",

489+

baseUrl: "http://127.0.0.1:11434",

490+

reasoning: true,

491+

compat: { supportsTools: true },

492+

});

493+

} finally {

494+

if (previous === undefined) {

495+

delete process.env.OLLAMA_API_KEY;

496+

} else {

497+

process.env.OLLAMA_API_KEY = previous;

498+

}

499+

}

500+

});

501+502+

it("keeps unknown requested Ollama models unresolved when show has no metadata", async () => {

503+

const provider = registerProvider();

504+

const previous = process.env.OLLAMA_API_KEY;

505+

process.env.OLLAMA_API_KEY = "ollama-local";

506+

buildOllamaProviderMock.mockResolvedValueOnce({

507+

baseUrl: "http://127.0.0.1:11434",

508+

api: "ollama",

509+

models: [],

510+

});

511+

queryOllamaModelShowInfoMock.mockResolvedValueOnce({});

512+513+

try {

514+

await provider.prepareDynamicModel?.({

515+

config: {},

516+

provider: "ollama",

517+

modelId: "depseek-v4-pro:cloud",

518+

modelRegistry: { find: vi.fn(() => null) },

519+

} as never);

520+521+

expect(

522+

provider.resolveDynamicModel?.({

523+

config: {},

524+

provider: "ollama",

525+

modelId: "depseek-v4-pro:cloud",

526+

modelRegistry: { find: vi.fn(() => null) },

527+

} as never),

528+

).toBeUndefined();

529+

} finally {

530+

if (previous === undefined) {

531+

delete process.env.OLLAMA_API_KEY;

532+

} else {

533+

process.env.OLLAMA_API_KEY = previous;

534+

}

535+

}

536+

});

537+423538

it("skips implicit localhost discovery when a custom remote Ollama provider is configured", async () => {

424539

const provider = registerProvider();

425540