From a7422ddeb7771983e984350b31092fe4898897c6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 21 Aug 2026 20:58:39 +0200 Subject: fix: web search on DeepSeek and other reasoning models A searched turn on a cloud reasoning model ended at the thinking: the model emitted the tool call, but finish_reason: "tool_calls" landed on the same SSE line as the include_usage block, so the single-event parser returned that line as a usage chunk and the loop never saw the tool finish. The parser now emits every event a line carries, so the search fires. Also in this change: - Replay each round's reasoning_content on the assistant tool-call message, which interleaved-thinking models require to keep going. - Add a per-provider replay_reasoning option (DeepSeek, SiliconFlow GLM-4.7+) to carry prior turns' reasoning_content when search is on. - Add an on-demand diagnostic log gated by $LLAMACHAT_DEBUG_LOG. - Record provider, usage_json and reported_cost_usd per reply, so a searched turn keeps every round's billed usage for external consumers. --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9a831..34314f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,10 +34,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `model`. Token counts come from the stream's final usage chunk and power the cost readout; the model column records which model actually replied, so a switched conversation prices each turn correctly. +- Three more columns on `messages`: `provider`, `usage_json` and + `reported_cost_usd`. The provider name is recorded when a reply finishes so + history stays self-describing even if a provider is later renamed or + removed; `usage_json` keeps every round's raw usage block from the stream + as a JSON array (a searched turn makes one API call per search round, and + all of them are billed, so all of them survive) for external consumers + such as the cost dashboard's ingester; and `reported_cost_usd` stores the + GUI's hand-entered-price estimate for the reply, summed across rounds, as + a sanity check only, staying NULL for an unpriced model rather than + claiming it cost nothing. - Per-provider `thinking_budget` option, for endpoints (currently SiliconFlow) that cap chain-of-thought tokens separately from the final answer. Unset providers skip the key entirely so other endpoints do not receive an unknown parameter. +- Per-provider `replay_reasoning` option. When set and web search is enabled, + each prior assistant turn's `reasoning_content` is replayed on the next + request, which interleaved-thinking providers (DeepSeek, SiliconFlow's + GLM-4.7+) require when a `tools` key is present. Off by default so other + providers do not pay context and input tokens for thinking they ignore. +- On-demand diagnostic log. Setting `LLAMACHAT_DEBUG_LOG` to a path appends + timestamped provider-error records (status, request body, full response) to + that file; unset, it writes nothing, so a normal launch never grows a log. ### Fixed @@ -48,6 +66,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 which could be too small for a reasoning model. Non-local providers now send `max_tokens = 32768`, leaving room for both chain-of-thought reasoning and the answer. +- A streamed tool call is now detected even when the provider puts + `finish_reason: "tool_calls"` on the same SSE line as the usage block (the + `include_usage` final chunk). The parser previously returned that line as + `usage` and dropped the finish signal, so a DeepSeek web search never + triggered and the turn ended at the thinking. +- A searched turn now replays the model's `reasoning_content` verbatim on the + assistant tool-call message. Interleaved-thinking models (DeepSeek V3.2+/V4, + GLM-4.7+ on SiliconFlow) require this and stop answering — ending the turn at + the thinking — when it is dropped. Tool calling and reasoning output vary between providers. Web search on a cloud model may not work as reliably as it does with a local router. -- cgit v1.2.3