mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 12:55:19 +00:00
refac
This commit is contained in:
parent
560702a8f7
commit
6bb204eb80
3 changed files with 8 additions and 3 deletions
|
|
@ -5,7 +5,7 @@
|
|||
import { onDestroy, onMount, tick } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { chatId, showSidebar, socket, user } from '$lib/stores';
|
||||
import { chatId, channelId as _channelId, showSidebar, socket, user } from '$lib/stores';
|
||||
import { getChannelById, getChannelMessages, sendMessage } from '$lib/apis/channels';
|
||||
|
||||
import Messages from './Messages.svelte';
|
||||
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
currentId = id;
|
||||
updateLastReadAt(id);
|
||||
_channelId.set(id);
|
||||
|
||||
top = false;
|
||||
messages = null;
|
||||
|
|
@ -220,6 +221,7 @@
|
|||
onDestroy(() => {
|
||||
// last read at
|
||||
updateLastReadAt(id);
|
||||
_channelId.set(null);
|
||||
$socket?.off('events:channel', channelEventHandler);
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ export const chatId = writable('');
|
|||
export const chatTitle = writable('');
|
||||
|
||||
export const channels = writable([]);
|
||||
export const channelId = writable(null);
|
||||
|
||||
export const chats = writable(null);
|
||||
export const pinnedChats = writable([]);
|
||||
export const tags = writable([]);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
appInfo,
|
||||
toolServers,
|
||||
playingNotificationSound,
|
||||
channels
|
||||
channels,
|
||||
channelId
|
||||
} from '$lib/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
|
|
@ -486,7 +487,7 @@
|
|||
const data = event?.data?.data ?? null;
|
||||
|
||||
if ($channels) {
|
||||
if ($channels.find((ch) => ch.id === event.channel_id)) {
|
||||
if ($channels.find((ch) => ch.id === event.channel_id) && $channelId !== event.channel_id) {
|
||||
channels.set(
|
||||
$channels.map((ch) => {
|
||||
if (ch.id === event.channel_id) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue