mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-04 11:19:07 -05:00
refac
This commit is contained in:
@@ -491,6 +491,22 @@ async def channel_events(sid, data):
|
||||
Channels.update_member_last_read_at(data['channel_id'], user['id'])
|
||||
|
||||
|
||||
@sio.on('events:chat')
|
||||
async def chat_events(sid, data):
|
||||
user = SESSION_POOL.get(sid)
|
||||
if not user:
|
||||
return
|
||||
|
||||
event_data = data.get('data', {})
|
||||
event_type = event_data.get('type')
|
||||
|
||||
if event_type == 'last_read_at':
|
||||
await asyncio.to_thread(
|
||||
Chats.update_chat_last_read_at_by_id,
|
||||
data['chat_id'], user['id']
|
||||
)
|
||||
|
||||
|
||||
def normalize_document_id(document_id: str) -> str:
|
||||
"""Canonicalize document IDs to prevent auth bypass via prefix variants.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user