fix(ollama): preserve streaming usage compat · openclaw/openclaw@930b443
steipete
·
2026-04-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,6 +19,7 @@ Docs: https://docs.openclaw.ai
|
19 | 19 | - CLI/models: keep route-first `models status --json` stdout reserved for the JSON payload by routing auth-profile and startup diagnostics to stderr. Fixes #72962. Thanks @vishutdhar. |
20 | 20 | - Sessions: ignore future-dated session activity timestamps during reset freshness checks and cap future `updatedAt` values at the merge boundary so clock-skewed messages cannot keep stale sessions alive forever. Fixes #72989. Thanks @martingarramon. |
21 | 21 | - Plugins/CLI: allow managed plugin installs when the active extensions root is a symlink to a real state directory, while keeping nested target symlinks blocked and suppressing misleading hook-pack fallback errors for install-boundary failures. Fixes #72946. Thanks @mayank6136. |
| 22 | +- Providers/Ollama: mark discovered Ollama catalog models as supporting streaming usage metadata so token accounting stays enabled for local models. (#72976) Thanks @sdeyang. |
22 | 23 | - Gateway/startup: keep hot Gateway boot paths on leaf config imports and add max-RSS reporting to the gateway startup bench so low-memory startup regressions are visible before release. Thanks @vincentkoc. |
23 | 24 | - WebChat: read `chat.history` from active transcript branches, drop stale streamed assistant tails once final history catches up, and coalesce duplicate in-flight Control UI submits, so rewritten prompts, completed replies, and rapid send events no longer render or process twice. Fixes #72975, #72963, and #72974. Thanks @dmagdici, @lhtpluto, and @Benjamin5281999. |
24 | 25 | - WebChat/TTS: persist automatic final-mode TTS audio as a supplemental audio-only transcript update instead of adding a second assistant message with the same visible text. Fixes #72830. Thanks @lhtpluto. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -261,22 +261,25 @@ describe("ollama provider models", () => {
|
261 | 261 | expect(visionModel.input).toEqual(["text", "image"]); |
262 | 262 | expect(visionModel.reasoning).toBe(true); |
263 | 263 | expect(visionModel.compat?.supportsTools).toBe(true); |
| 264 | +expect(visionModel.compat?.supportsUsageInStreaming).toBe(true); |
264 | 265 | |
265 | 266 | const textModel = buildOllamaModelDefinition("glm-5.1:cloud", 202752, ["completion", "tools"]); |
266 | 267 | expect(textModel.input).toEqual(["text"]); |
267 | 268 | expect(textModel.reasoning).toBe(false); |
268 | 269 | expect(textModel.compat?.supportsTools).toBe(true); |
| 270 | +expect(textModel.compat?.supportsUsageInStreaming).toBe(true); |
269 | 271 | |
270 | 272 | const noCapabilities = buildOllamaModelDefinition("unknown-model", 65536); |
271 | 273 | expect(noCapabilities.input).toEqual(["text"]); |
272 | | -expect(noCapabilities.compat).toBeUndefined(); |
| 274 | +expect(noCapabilities.compat?.supportsUsageInStreaming).toBe(true); |
273 | 275 | }); |
274 | 276 | |
275 | 277 | it("disables tool support when Ollama capabilities omit tools", () => { |
276 | 278 | const model = buildOllamaModelDefinition("embeddinggemma:latest", 2048, ["embedding"]); |
277 | 279 | |
278 | 280 | expect(model.reasoning).toBe(false); |
279 | 281 | expect(model.compat?.supportsTools).toBe(false); |
| 282 | +expect(model.compat?.supportsUsageInStreaming).toBe(true); |
280 | 283 | }); |
281 | 284 | |
282 | 285 | it("parses the last positive Modelfile num_ctx value", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -249,9 +249,10 @@ export function buildOllamaModelDefinition(
|
249 | 249 | : capabilities.includes("thinking"); |
250 | 250 | const compat = |
251 | 251 | capabilities === undefined |
252 | | - ? undefined |
| 252 | + ? { supportsUsageInStreaming: true } |
253 | 253 | : { |
254 | 254 | supportsTools: capabilities.includes("tools"), |
| 255 | +supportsUsageInStreaming: true, |
255 | 256 | }; |
256 | 257 | return { |
257 | 258 | id: modelId, |
@@ -261,7 +262,7 @@ export function buildOllamaModelDefinition(
|
261 | 262 | cost: OLLAMA_DEFAULT_COST, |
262 | 263 | contextWindow: contextWindow ?? OLLAMA_DEFAULT_CONTEXT_WINDOW, |
263 | 264 | maxTokens: OLLAMA_DEFAULT_MAX_TOKENS, |
264 | | -...(compat ? { compat } : {}), |
| 265 | + compat, |
265 | 266 | }; |
266 | 267 | } |
267 | 268 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。