From 8ef0f7743b99167ec16e4b6ec97e913cfced4d13 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 5 Jan 2026 23:13:05 +0400 Subject: [PATCH] refac --- 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 07b5a4b5ee..a6f39e15f9 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2723,6 +2723,9 @@ async def process_chat_response( # Emit pending tool calls in real-time if response_tool_calls: + # Flush any pending text first + await flush_pending_delta_data() + pending_content_blocks = content_blocks + [ { "type": "tool_calls",