Timothy Jaeryang Baek 1 month ago
parent
commit
a650d77af4
2 changed files with 10 additions and 2 deletions
  1. 1 1
      backend/open_webui/routers/chats.py
  2. 9 1
      backend/open_webui/socket/main.py

+ 1 - 1
backend/open_webui/routers/chats.py

@@ -416,7 +416,7 @@ async def update_chat_message_by_id(
     )
 
     if event_emitter:
-        event_emitter(
+        await event_emitter(
             {
                 "type": "chat:message",
                 "data": {

+ 9 - 1
backend/open_webui/socket/main.py

@@ -272,8 +272,16 @@ async def disconnect(sid):
 def get_event_emitter(request_info, update_db=True):
     async def __event_emitter__(event_data):
         user_id = request_info["user_id"]
+
         session_ids = list(
-            set(USER_POOL.get(user_id, []) + [request_info["session_id"]])
+            set(
+                USER_POOL.get(user_id, [])
+                + (
+                    [request_info.get("session_id")]
+                    if request_info.get("session_id")
+                    else []
+                )
+            )
         )
 
         for session_id in session_ids: