Timothy Jaeryang Baek 2 months ago
parent
commit
aa7184ae0d
2 changed files with 10 additions and 0 deletions
  1. 8 0
      backend/open_webui/utils/middleware.py
  2. 2 0
      src/lib/components/chat/Chat.svelte

+ 8 - 0
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):

+ 2 - 0
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);