diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 4b7e6a0e6..b2bccbf66 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1090,6 +1090,14 @@ async def process_chat_response( task_id = str(uuid4()) # Create a unique task ID. model_id = form_data.get("model", "") + Chats.upsert_message_to_chat_by_id_and_message_id( + metadata["chat_id"], + metadata["message_id"], + { + "model": model_id, + }, + ) + # Handle as a background task async def post_response_handler(response, events): def serialize_content_blocks(content_blocks, raw=False): diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index dec3c2676..b4717af2b 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1399,6 +1399,8 @@ // Save chat after all messages have been created await saveChatHandler(_chatId); + await tick(); + await Promise.all( selectedModelIds.map(async (modelId, _modelIdx) => { console.log('modelId', modelId);