mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
issue: Frontend Display Glitch: replace Event Causes Brief Flash and Revert of Streamed Content #5434
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 @olivier-lacroix on GitHub (Jun 4, 2025).
Originally assigned to: @jackthgu on GitHub.
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.13
Ollama Version (if applicable)
N/A
Operating System
N/A
Browser (if applicable)
Firefox
Confirmation
README.md.Expected Behavior
I think there are some sort of 'data race' when using
replaceevent. The dummy pipe below reproduces what I have experienced in a 'real' pipe.In that dummy pipe, I expect the initial streamed content ("This is the first part...", "This is the second part...", "This is the third part...") appear. After the pause, "This content has been replaced!" should appear and remain on screen, replacing the original streamed content.
Actual Behavior
The initial streamed content appears correctly. After the pause, "This content has been replaced!" briefly flashes on screen, but then the display immediately reverts to showing the original streamed content. The intended replacement is not sustained.
Steps to Reproduce
Create the following dummy pipeline
Logs & Screenshots
Docker logs did not seem to surface anything useful.
Relevant browser logs (screenshot, as, for the life of me, could not figure out how to export logs with objects expanded in firefox)
Additional Information
No response
@jackthgu commented on GitHub (Jun 5, 2025):
Hello,
First of all, thank you for writing such a precise piece of code to test and point out this potential issue.
The cause of this behavior is that the replace event is triggered twice — this happens because the title also performs a replace operation.
To avoid this issue, you can try modifying the code as shown below.
Also, please pay attention to the task parameter in the pipe function — it plays a key role in how the behavior is handled depending on the request context.
Since it works well in our environment, we’ll go ahead and close this issue.
If the result is not as expected or if you encounter any other issues, please feel free to let us know anytime.
Thank you!
@RAPHCVR commented on GitHub (Jun 11, 2025):
Hey @jackthgu, thanks for the tip on using the event-based approach! It successfully resolved the initial "flash/revert" issue.
However, I've encountered a small follow-up problem. It seems the UI handles streamed content from
yielddifferently than content from achat:message:deltaevent.When using
yield, the<thinking>tags are correctly interpreted by the UI to show the thinking visualization. But when I send the same<thinking>tags inside achat:message:deltaevent, they are printed literally as text to the screen.The issue: The event-based method prints
<thinking>tags as-is.This code sends the literal string
"<thinking>"to the UI, which is not what's intended.In a previous version using
yield, this worked correctly:So what would be the correct event to send via
__event_emitter__to toggle the "thinking" UI state, instead of just printing the tag? I suspect there might be a dedicated event type for this, like{"type": "thinking", "data": ...}.Thanks for your help
@olivier-lacroix commented on GitHub (Jun 20, 2025):
Thanks a lot @jackthgu ! in the actual pipeline, switching from
yieldto thechat:message:deltaworks. It is also faster :)Looking at the console, I can see the complete content is resent each time with the original code. I am surprised both forms are not equivalent. Shouldn't openwebui send the delta only when using yield?
@HEI204 commented on GitHub (Aug 15, 2025):
I have similar issue but I using Pipeline class, is any solution to solve?
Since pipeline class do not have the attribute "__task""