From 71810a9b3cec3a9628c235b6d0e88b5829de8979 Mon Sep 17 00:00:00 2001 From: maco Date: Sun, 9 Aug 2026 21:36:54 +0200 Subject: [PATCH] fix: stop replaying empty assistant placeholders to the provider Closes #25083 --- backend/open_webui/utils/middleware.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 1daccff6ad..2aa82804bb 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2096,6 +2096,11 @@ def process_messages_with_output( processed.extend(output_messages) continue + if message.get('role') == 'assistant' and not message.get('tool_calls'): + content = message.get('content') + if not (content.strip() if isinstance(content, str) else content): + continue + # Strip 'output' field before adding (LLM shouldn't see it) clean_message = {k: v for k, v in message.items() if k != 'output'} processed.append(clean_message)