mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 07:46:16 -05:00
[GH-ISSUE #22605] issue: MESSAGES:MIDDLETRUNCATE:500 didn't work #58429
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 @cloudtuotuo on GitHub (Mar 12, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22605
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.8.10
Ollama Version (if applicable)
No response
Operating System
Ubuntu
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Task message truncation doesn't work. OWU still passes over 500 tokens to AI model.
My Title Generation Prompt:
Chat history
<chat_history>
{{MESSAGES:MIDDLETRUNCATE:500}}
</chat_history>
Actual Behavior
Only pass 500 tokens to AI model.
Steps to Reproduce
Title Generation Prompt:
...
Chat history
<chat_history>
{{MESSAGES:MIDDLETRUNCATE:500}}
</chat_history>
Logs & Screenshots
There's no error info.
Additional Information
No response
@Classic298 commented on GitHub (Mar 12, 2026):
MESSAGES:MIDDLETRUNCATE:500 selects up to 500 MESSAGES, not 500 tokens. It takes the first ~250 messages and last ~250 messages if there are more than 500 messages total.
To truncate each message's content, you need to filter it via pipe: {{MESSAGES|middletruncate:500}} (truncates each message's content to 500 characters) or {{MESSAGES:MIDDLETRUNCATE:10|middletruncate:50}} (selects 10 messages, truncates each to 50 chars).
@cloudtuotuo commented on GitHub (Mar 12, 2026):
Thanks a lot. It works.