fix(ollama): keep configured max thinking compatible · openclaw/openclaw@0b46227
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1246,6 +1246,35 @@ describe("createOllamaStreamFn", () => {
|
1246 | 1246 | ); |
1247 | 1247 | }); |
1248 | 1248 | |
| 1249 | +it("maps configured native Ollama params.thinking=max to the stable top-level think value", async () => { |
| 1250 | +await withMockNdjsonFetch( |
| 1251 | +[ |
| 1252 | +'{"model":"m","created_at":"t","message":{"role":"assistant","content":"ok"},"done":false}', |
| 1253 | +'{"model":"m","created_at":"t","message":{"role":"assistant","content":""},"done":true,"prompt_eval_count":1,"eval_count":1}', |
| 1254 | +], |
| 1255 | +async (fetchMock) => { |
| 1256 | +const stream = await createOllamaTestStream({ |
| 1257 | +baseUrl: "http://ollama-host:11434", |
| 1258 | +model: { params: { thinking: "max" } }, |
| 1259 | +}); |
| 1260 | + |
| 1261 | +const events = await collectStreamEvents(stream); |
| 1262 | +expect(events.at(-1)?.type).toBe("done"); |
| 1263 | + |
| 1264 | +const requestInit = getGuardedFetchCall(fetchMock).init ?? {}; |
| 1265 | +if (typeof requestInit.body !== "string") { |
| 1266 | +throw new Error("Expected string request body"); |
| 1267 | +} |
| 1268 | +const requestBody = JSON.parse(requestInit.body) as { |
| 1269 | +think?: string; |
| 1270 | +options?: { think?: string }; |
| 1271 | +}; |
| 1272 | +expect(requestBody.think).toBe("high"); |
| 1273 | +expect(requestBody.options?.think).toBeUndefined(); |
| 1274 | +}, |
| 1275 | +); |
| 1276 | +}); |
| 1277 | + |
1249 | 1278 | it("uses the default loopback policy when baseUrl is empty", async () => { |
1250 | 1279 | await withMockNdjsonFetch( |
1251 | 1280 | [ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。