mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[GH-ISSUE #15081] issue: Default follow-up generation consumes full context, causing unexpected high credit usage on long prompts #72065
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @inno3759 on GitHub (Jun 17, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15081
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.15
Operating System
Debian 12
Confirmation
README.md.Expected Behavior
Actual Behavior
The default follow-up prompt blindly includes the entire conversation history, causing each follow-up call to resend the full context and incur high credit usage in the UI auxiliary model.
The replace_messages_variable function implements {{MESSAGES:END:X}} by doing:
In the default follow-up prompt template, {{MESSAGES:END:6}} therefore pulls in the last six messages verbatim. If one of those messages contains a very large document, every follow-up generation call resends that entire document to the auxiliary model and incurs a huge token cost.
Steps to Reproduce
Additional Information
The default follow-up prompt template pulls in the last six messages ({{MESSAGES:END:6}}) regardless of their size. If one of those messages is a very large document, every follow-up call resends that large prompt to the auxiliary model, driving up token usage and costs unexpectedly in that model.
My temporary prompt:
Ignore all previous instructions.
Suggest 3-5 relevant follow-up questions or prompts that the user might naturally ask next in this conversation as a user, based on the chat history, to help continue or deepen the discussion.
Guidelines:
Output:
JSON format: { "follow_ups": ["Question 1?", "Question 2?", "Question 3?"] }
Chat History:
<chat_history>
{{prompt:middletruncate:7500}}
</chat_history>
@Classic298 commented on GitHub (Jun 17, 2025):
Generally, it is advisable to use very cheap models as a task model something like gemini 2.0 flash lite or gpt 4.1 nano.
Even with large inputs you will be billed at most a cent or so typically.
But be that as it may, unlike you say, it's not the entire conversation history that gets sent to the task model, just a few messages. And the other tasks do that too (title generation, tag generation, etc.)
But your proposal to add a character based truncation point to truncate each message of those 6 fetched messages is not bad. Perhaps it can be added as a universal setting for all task model tasks.
I.e. every single task will fetch the messages as normal, then truncate them to ABCXYZ characters (whatever has been set in the document settings in the admin panel) and only then insert it into the task's prompt and send it to the task model.
@Classic298 commented on GitHub (Jun 17, 2025):
Proposed a PR https://github.com/open-webui/open-webui/pull/15087
@tjbck commented on GitHub (Jun 18, 2025):
For this exactly reason you can write your own custom prompt template for follow up generation. This should be added to our docs, PR welcome!
@arrr444 commented on GitHub (Aug 3, 2025):
How can i enable Followup to certain custom models we created and disable it to others, to control which models the followup appear to and dont every model, i tried tweaking the prompt by saying if model name is """" show questions or if so dont, but it didnt work