From 1058444d7474d66443569c02b6e7fef219cbd16c Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 30 Sep 2026 19:02:27 +0200 Subject: [PATCH] fix: artifact preview closes right after opening when a filter writes the reply (#31652) Since 0.11.1, when a filter function wrote part of the reply before the model answered (for example some text and an HTML block), the artifact preview opened and then closed straight away. The page showed the filter text but was never sent it as part of the reply, so the model's first output overwrote it, the page briefly saw no HTML block and closed the preview. The filter text is now sent to the page before the model's output, so the preview stays open. Fixes #31643 --- backend/open_webui/utils/middleware.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 6a3e4b6f5b..50d8617298 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -4784,6 +4784,9 @@ async def streaming_chat_response_handler(response, ctx): 'content': [{'type': 'output_text', 'text': initial_content}], } ] + if not continuing: + # the client needs this item before the first delta arrives + await event_emitter({'type': 'chat:completion', 'data': {'output': output}}) else: output = []