Commit Graph
858 Commits
Author SHA1 Message Date
Timothy Jaeryang Baek c5c42fe3b7 refac 2026-11-21 16:20:44 +04:00
Timothy Jaeryang Baek 43d7281f4e refac 2026-11-18 18:55:30 +04:00
Classic298 47cf51eb78 perf: send tool results to the model as compact JSON (#34640)
Tool results returned as a JSON object or list were re-indented with two spaces before being handed to the model, so those tool calls paid tokens for whitespace nobody reads. They now go to the model as compact JSON. The tool call panel in the chat still shows them pretty-printed, because it formats the result on its own.

Measured on real Open Terminal responses (o200k tokenizer):

| Tool | Before | After | Saved |
|---|---|---|---|
| list_files | 1013 | 672 | 34% |
| glob_search | 2821 | 2061 | 27% |
| grep_search | 2233 | 1652 | 26% |
| run_command | 649 | 614 | 5% |
| read_file | 3254 | 3245 | 0% |

Fixes #34639
2026-11-18 15:47:28 +04:00
Classic298 d8ba9d5538 fix: stopping a long tool-calling reply makes the next message compact too early (#34627)
A stopped reply was saved without the token counts the model had already reported for it, so the next message had to estimate the reply's size from its text. That estimate includes the model's thinking, which is often not sent back to the model, so after a long tool-calling run it could come out far larger than the real context and trigger compaction well before the threshold. A stopped reply now keeps the counts reported so far, marked incomplete, so the size check starts from the real number; text the stopped round produced after its last report is not counted, which is far less than what the old estimate added. Stopped replies now also show their token usage and count toward the analytics token totals, still not as complete responses.

Fixes #34626
2026-11-18 04:56:20 +04:00
Timothy Jaeryang Baek 916c03829d chore: format 2026-11-17 22:37:26 +09:00
Timothy Jaeryang Baek 4dad777cdb refac 2026-11-17 22:30:21 +09:00
Timothy Jaeryang Baek bf8a8dcc7f refac 2026-11-17 20:28:38 +09:00
Timothy Jaeryang Baek c201472cf8 refac 2026-11-17 19:31:57 +09:00
Timothy Jaeryang Baek e1d2722520 refac 2026-11-17 18:48:38 +09:00
Timothy Jaeryang Baek f14dca0eec refac 2026-11-17 00:14:38 +09:00
Timothy Jaeryang Baek 445db6d0b5 refac 2026-11-16 23:55:22 +09:00
Timothy Jaeryang Baek 6afb1681c9 refac 2026-11-16 19:38:00 +09:00
Classic298 80478abea1 fix: assistant messages with only tool calls are sent with an empty string instead of null (#34265)
When an assistant message has tool calls but no text, the OpenAI Chat Completions format uses `content: null`, since content is optional next to tool calls and OpenAI's own API returns null there. Open WebUI sent an empty string in two places: when replaying earlier tool calls from the chat history, and when converting requests from clients that use its Anthropic-compatible endpoint. For Claude models, LiteLLM 1.81.14 through 1.108.x replaces that empty string with "[System: Empty message content sanitised to satisfy protocol]", and the model then repeats that line in its replies (LiteLLM 1.109 and later leave the empty text out instead). These messages now go out with null content, which OpenAI and every provider tested on OpenRouter (Gemini, Claude, DeepSeek, Qwen, Mistral, Llama, Kimi and Grok) accept.

Fixes #34264
2026-11-13 18:26:08 +09:00
Timothy Jaeryang Baek 4720ff19e7 refac 2026-11-13 17:36:00 +09:00
Classic298 64471947ab fix: a compaction during a tool run drops the earlier conversation summary (#34151)
When a turn started from an existing summary and its reply then compacted again between tool calls, the new summary was written without the earlier one whenever the plain summary prompt was used (a model with a filter, a separate Context Compaction Model, or a provider that refuses the cached replay). From the next turn on, everything the earlier summary held was gone. That compaction now gets the turn's summary as its previous summary, as a compaction at the start of a turn already does.

Fixes #34141
2026-11-12 21:52:18 +09:00
Timothy Jaeryang Baek 44d55bd0f0 refac 2026-11-12 21:49:53 +09:00
Classic298 c557cf58aa fix: background memory review saves memories from temporary chats (#34263)
With the background memory review on, Open WebUI looks back over the chat every few messages (10 by default) to save or update memories, and it did this in temporary chats too. Facts from a temporary chat could end up as memories that stayed after the chat was closed and showed up in later chats. The automatic review now skips temporary chats, so they leave no memories behind unless the user asks for one. Normal chats are reviewed as before, and memories already saved from a temporary chat are not removed.

Fixes #34262
2026-11-12 21:42:03 +09:00
Timothy Jaeryang Baek e46920dcc7 refac 2026-11-11 15:34:33 +09:00
Timothy Jaeryang Baek 28c5fba889 refac 2026-11-11 13:49:51 +09:00
Classic298 974367529c fix: DeepSeek thinking mode errors when a chat uses skills, knowledge or memories (#33950)
Starting with 0.13.1, DeepSeek in thinking mode returned the error "The `reasoning_content` in the thinking mode must be passed back to the API." for any chat that uses skills, attached knowledge or memories, even with the connection's Provider set to llama.cpp. Since that release these features reach the model through tool calls behind the scenes, and DeepSeek requires reasoning on every earlier tool call, which these tool calls never have. On connections with Provider set to llama.cpp, Open WebUI now fills in an empty reasoning for any earlier tool call that has none, which DeepSeek accepts, so these chats work again. Connections with Provider set to Default are unchanged: they send no reasoning back, so DeepSeek still needs the llama.cpp setting.

Fixes #33940
2026-11-09 06:40:57 +09:00
Timothy Jaeryang Baek e8c0ad85e5 refac 2026-11-08 18:37:29 +09:00
Timothy Jaeryang Baek 9126f2262c refac 2026-11-08 15:30:13 +09:00
Timothy Jaeryang Baek 2416b1fc0b refac 2026-11-08 15:27:19 +09:00
Classic298 06ff3f9195 fix: a malformed tool call with Tool Search on ends tool use for the rest of the reply (#33872)
With Tool Search on, when the model sent a broken call for a tool Tool Search had not loaded yet (arguments that were not a JSON object, or a list of tool calls that was empty or in the wrong format), Open WebUI handled it like an unfinished model response and the rest of the reply ran without any tools. Now the model gets a tool error back, like it does for an unknown tool name, and can retry with its tools. Only a model response that really was cut off still ends tool use.

Fixes #33871
2026-11-08 10:53:50 +09:00
Timothy Jaeryang Baek 003299641e refac 2026-11-08 01:44:08 +09:00
Classic298 842261a4a8 fix: skip the knowledge and skill lists when there is nothing to list (#33812)
With native function calling, the model got a hidden list of the attached knowledge and of the user's skills before every new reply, even when no knowledge was attached and the user had no skills, so every chat spent tokens on two empty lists. A custom pipe function that reads the last message as the user's question got the empty knowledge list instead of the question. Each list is now left out when it is empty, as in 0.13.0.

Fixes #33807
2026-11-06 22:03:50 +09:00
Timothy Jaeryang Baek 18f7633afa refac 2026-11-06 13:40:53 +09:00
Timothy Jaeryang Baek 8eb2cabf49 refac 2026-11-06 13:33:33 +09:00
Timothy Jaeryang Baek e037ad0735 refac 2026-11-06 13:29:44 +09:00
Timothy Jaeryang Baek 003c9e0854 refac 2026-11-06 13:24:49 +09:00
Timothy Jaeryang Baek 6f4c7f8935 refac 2026-11-06 13:23:52 +09:00
Timothy Jaeryang Baek e6ae368f51 refac 2026-11-06 13:17:42 +09:00
Timothy Jaeryang Baek 0986adfb15 refac 2026-11-06 12:58:35 +09:00
Timothy Jaeryang Baek 0f3bd0a7ea refac 2026-11-06 12:40:49 +09:00
Timothy Jaeryang Baek 6e8a6c4467 refac 2026-11-06 11:34:51 +09:00
Timothy Jaeryang Baek bd6fc15bee refac 2026-11-06 11:12:04 +09:00
Timothy Jaeryang Baek 8e2ba2937e refac 2026-11-06 10:38:09 +09:00
Timothy Jaeryang Baek 97f71f6ebb refac 2026-11-06 08:53:00 +09:00
Timothy Jaeryang Baek d878373728 refac 2026-11-06 08:41:30 +09:00
Classic298 c384d8e514 fix: split tool calls leave an extra unfinished tool call in the chat (#33779)
When a model sends several tool calls glued into one (for example GPT-5.4 putting two JSON argument sets in a single call), Open WebUI ran each part but also kept the original call in the message with the broken combined arguments and no result. That showed up as an extra tool call that never gets a result, and it was dropped silently when the chat was sent back to the model. The first part now reuses the original call, so every tool call in the message has exactly one result.

Fixes #33778
2026-11-06 08:19:36 +09:00
Classic298 dd42f4e913 refac: skip background work for accounts that were deactivated meanwhile (#33801)
Follow-up generation after a response and replies to channel mentions are now skipped when the account that triggered them has been deactivated in the meantime.
2026-11-06 07:53:32 +09:00
Classic298 f59552efff perf: stop resending the whole reply on every reasoning chunk with OpenRouter-style providers (#33698)
Providers such as OpenRouter attach reasoning details to every reasoning chunk, and each of those chunks made Open WebUI send the entire reply so far to the browser and, with Redis, rewrite the copy kept for page reloads. The browser never shows these details, so a long reasoning reply moved tens of megabytes for a few kilobytes of text. Those chunks now stream like any other reasoning text, and the details are still saved with the reply and still sent back to the provider on the next request.

Measured against a simulated OpenRouter-style provider streaming 1,500 reasoning chunks:

| | before | after |
|---|---|---|
| Data sent to the browser | 73.6 MB | 0.73 MB |
| Redis writes for the reload copy | 1,504 | 19 |
2026-11-05 22:30:39 +09:00
Timothy Jaeryang Baek 8366e28725 refac 2026-11-05 21:59:46 +09:00
Timothy Jaeryang Baek 404d27a36e refac 2026-11-05 11:41:25 +09:00
Timothy Jaeryang Baek a8b478ed7b refac 2026-11-03 17:17:59 +09:00
Timothy Jaeryang Baek e789513ea6 refac 2026-11-03 16:25:23 +09:00
Timothy Jaeryang Baek ddb43c83ba refac 2026-11-02 12:45:15 +09:00
Timothy Jaeryang Baek 47a9e7d48d refac 2026-11-02 12:09:54 +09:00
Timothy Jaeryang Baek d99ec1c02c refac 2026-11-02 08:48:51 +09:00
Timothy Jaeryang Baek 0e0ba872a4 refac 2026-10-30 07:50:55 +09:00