From d42f811a8d562b30ad1b4b481a6bf010a5ad15c6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 22 Jan 2025 00:49:41 -0800 Subject: [PATCH] refac: think tag --- backend/open_webui/utils/middleware.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 9f6d60977..6e5d5d968 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1144,7 +1144,7 @@ async def process_chat_response( ) if reasoning_content: - reasoning_content = "\n".join( + reasoning_display_content = "\n".join( ( f"> {line}" if not line.startswith(">") @@ -1154,14 +1154,14 @@ async def process_chat_response( ) # Format reasoning with
tag - content = f"{ongoing_content}
\nThought for {reasoning_duration} seconds\n{reasoning_content}\n
\n" + content = f"{ongoing_content}
\nThought for {reasoning_duration} seconds\n{reasoning_display_content}\n
\n" else: content = "" reasoning_start_time = None else: - reasoning_content = "\n".join( + reasoning_display_content = "\n".join( ( f"> {line}" if not line.startswith(">") @@ -1171,7 +1171,7 @@ async def process_chat_response( ) # Show ongoing thought process - content = f"{ongoing_content}
\nThinking… \n{reasoning_content}\n
\n" + content = f"{ongoing_content}
\nThinking… \n{reasoning_display_content}\n
\n" if ENABLE_REALTIME_CHAT_SAVE: # Save message in the database