mirror of
https://github.com/open-webui/open-webui
synced 2025-01-19 09:16:44 +00:00
refac
This commit is contained in:
parent
c8cdc6377b
commit
3da7ff1721
@ -62,25 +62,33 @@
|
||||
|
||||
if (type === 'message') {
|
||||
if ((data?.parent_id ?? null) === threadId) {
|
||||
if (messages) {
|
||||
messages = [data, ...messages];
|
||||
|
||||
if (typingUsers.find((user) => user.id === event.user.id)) {
|
||||
typingUsers = typingUsers.filter((user) => user.id !== event.user.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type === 'message:update') {
|
||||
if (messages) {
|
||||
const idx = messages.findIndex((message) => message.id === data.id);
|
||||
|
||||
if (idx !== -1) {
|
||||
messages[idx] = data;
|
||||
}
|
||||
}
|
||||
} else if (type === 'message:delete') {
|
||||
if (messages) {
|
||||
messages = messages.filter((message) => message.id !== data.id);
|
||||
}
|
||||
} else if (type.includes('message:reaction')) {
|
||||
if (messages) {
|
||||
const idx = messages.findIndex((message) => message.id === data.id);
|
||||
if (idx !== -1) {
|
||||
messages[idx] = data;
|
||||
}
|
||||
}
|
||||
} else if (type === 'typing' && event.message_id === threadId) {
|
||||
if (event.user.id === $user.id) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user