From 48635ced35e3aefe7c93e1e85bb9a5de52bcf511 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 28 Aug 2025 02:45:06 +0400 Subject: [PATCH] refac --- backend/open_webui/socket/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index 47abb0915d..63b6c17b9c 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -705,6 +705,23 @@ def get_event_emitter(request_info, update_db=True): }, ) + if "type" in event_data and event_data["type"] == "files": + message = Chats.get_message_by_id_and_message_id( + request_info["chat_id"], + request_info["message_id"], + ) + + files = event_data.get("data", {}).get("files", []) + files.extend(message.get("files", [])) + + Chats.upsert_message_to_chat_by_id_and_message_id( + request_info["chat_id"], + request_info["message_id"], + { + "files": files, + }, + ) + return __event_emitter__