diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 76a2a0976..7d79e1d0b 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -776,7 +776,10 @@ async def process_chat_response( "content", message.get("content", "New Chat"), ) - ) + ).strip() + + if not title: + title = messages[0].get("content", "New Chat") Chats.update_chat_title_by_id(metadata["chat_id"], title)