mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[GH-ISSUE #24585] issue: __event_emitter__ type replace modified message lost after refresh in Action Function #123662
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 @knives on GitHub (May 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24585
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.9.3, 0.9.4, 0.9.5
Ollama Version (if applicable)
No response
Operating System
Windows 11
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Expect the event_emitter message to persist after refresh in action function.
function-emit_action-export-1778525917500.json
FUNCTION CODE :
`
from pydantic import BaseModel, Field
from typing import Optional
class Action:
async def action(
self, body: dict, user=None, event_emitter=None, request=None
):
# 1. Mise à jour UI (frontend state)
await event_emitter(
{"type": "replace", "data": {"content": "event emitter replace type"}}
)
`
Actual Behavior
The replaced message with event_emitter is back to the original LLM output
1 -> Action function replace the message
2 -> Refresh
3 -> The message displayed is the original LLM output or the custom modified messaged (edit button)
Steps to Reproduce
1 -> Begin a new chat
2 -> Enter a command
3 -> Wait for the output
4 -> Click on the Action button
5 -> Refresh or change chat (leave the chat)
3 -> Go back to the chat/message where you clicked on the Action button
Logs & Screenshots
https://github.com/user-attachments/assets/d51bf4a1-277e-4be5-b9c9-914333e20567
Docker logs :
2026-05-11 19:08:18.049 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - 127.0.0.1:35662 - "POST /api/v1/chats/8007d0e5-77f9-4c53-a343-6df08f3b73b4/messages HTTP/1.1" 405
2026-05-11 19:08:18.049 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - 192.168.65.1:27235 - "POST /api/chat/actions/emit_action HTTP/1.1" 200
2026-05-11 19:08:18.078 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - 192.168.65.1:27235 - "POST /api/v1/chats/8007d0e5-77f9-4c53-a343-6df08f3b73b4 HTTP/1.1" 200
2026-05-11 19:08:18.093 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - 192.168.65.1:27235 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200
Additional Information
Works fine in 0.9.2
Not working on 0.9.3, 0.9.4 and 0.9.5
@owui-terminator[bot] commented on GitHub (May 11, 2026):
🔍 Related Issues Found
I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:
🟣 #23171 issue: message.done state is unreliable — switching chats or refreshing the page causes premature display of thinking process and action buttons
This issue is closely related because it describes chat state becoming unreliable after refresh/navigation, causing UI state to be reconstructed incorrectly. Your report is also about a message state change not persisting after refresh, but for action-function replacements rather than done-state/action-button visibility.
by ShirasawaSama ·
bug🟣 #21564 issue: "Edit" and "Continue Response" don't work properly
This is related because it involves the Edit/Continue Response message mutation path not behaving correctly, which is the same general area of message modification persistence. While the exact symptom differs, both issues concern edited assistant messages not being reflected correctly in the chat UI.
by TheObserver-000 ·
bug🟣 #20824 issue: Response from model does not appear until page refresh
This issue is about generated assistant content only appearing after a page refresh, showing a refresh-related rendering/state-sync problem in the message timeline. It is less specific than your report, but still relevant because both bugs involve message content not surviving or appearing correctly across refreshes.
by NTShop ·
bug💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.
This comment was generated automatically. React with 👍 if helpful, 👎 if not.
@Classic298 commented on GitHub (May 11, 2026):
the replace is only for rich UI elements i believe. if you want to edit the message and persist it you have to do it another way. the replace is only for embeds i believe
@knives commented on GitHub (May 12, 2026):
Hello,
I have checked the docs before submitting the tickets :
https://docs.openwebui.com/features/extensibility/plugin/development/events/#which-event-types-are-persisted-to-the-database
I also tried the return str and dict method for Actions :
https://docs.openwebui.com/features/extensibility/plugin/development/events/#actions
I have the same results (and in the case of str return, the content is not modified)
STR return function
dict return function
Result :
I also have checked the update_db parameter of the even_emitter in the action function : the update_db parameter is set to true for the parameter sent to the Action.
Docker logs :
{'chat_id': 'xxx', 'message_id': 'xxx', 'session_id': 'xxx', 'user_id': 'xxx'}
True
Did i misunderstood the documentation ?
It worked fine in 0.9.2 and in earlier version too.
@Classic298 commented on GitHub (May 12, 2026):
hm i forgot this replace method for messages existed. but for me it never worked to be persistent. it worked for you before 0.9.2? are you sure?
@knives commented on GitHub (May 12, 2026):
Hello,
Yes I'm sure it worked on 0.9.2 (at least for the original case with the event_emitter) and before.
I just made a new test on the 0.9.2 version with the 3 type of solutions :
here a video of the test
https://github.com/user-attachments/assets/8a6a5236-69e8-45e2-b1dc-cfdc243d86e2