From aa51ce482c161fb423767c41e8166197dce2d11b Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 9 May 2026 15:21:31 +0900 Subject: [PATCH] refac --- backend/open_webui/socket/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index bed04c549b..20e78d6c37 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -888,13 +888,15 @@ async def get_event_emitter(request_info, update_db=True): ) elif event_type == 'embeds': - message = await Chats.get_message_by_id_and_message_id( - request_info['chat_id'], - request_info['message_id'], - ) + event_payload = event_data.get('data', {}) + embeds = event_payload.get('embeds', []) - embeds = event_data.get('data', {}).get('embeds', []) - embeds.extend(message.get('embeds', [])) + if not event_payload.get('replace', False): + message = await Chats.get_message_by_id_and_message_id( + request_info['chat_id'], + request_info['message_id'], + ) + embeds.extend(message.get('embeds', [])) await Chats.upsert_message_to_chat_by_id_and_message_id( request_info['chat_id'],