mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
parent
387c2377ba
commit
6076afd5f5
@ -432,31 +432,20 @@
|
||||
}
|
||||
};
|
||||
|
||||
let pageSubscribe = null;
|
||||
onMount(async () => {
|
||||
loading = true;
|
||||
console.log('mounted');
|
||||
window.addEventListener('message', onMessageHandler);
|
||||
$socket?.on('chat-events', chatEventHandler);
|
||||
|
||||
page.subscribe((page) => {
|
||||
if (page.url.pathname === '/') {
|
||||
pageSubscribe = page.subscribe(async (p) => {
|
||||
if (p.url.pathname === '/') {
|
||||
await tick();
|
||||
initNewChat();
|
||||
}
|
||||
});
|
||||
|
||||
if (!$chatId) {
|
||||
chatIdUnsubscriber = chatId.subscribe(async (value) => {
|
||||
if (!value) {
|
||||
await tick(); // Wait for DOM updates
|
||||
await initNewChat();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if ($temporaryChatEnabled) {
|
||||
await goto('/');
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
|
||||
prompt = '';
|
||||
files = [];
|
||||
@ -515,6 +504,7 @@
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
pageSubscribe();
|
||||
chatIdUnsubscriber?.();
|
||||
window.removeEventListener('message', onMessageHandler);
|
||||
$socket?.off('chat-events', chatEventHandler);
|
||||
|
@ -490,6 +490,8 @@
|
||||
draggable="false"
|
||||
on:click={async () => {
|
||||
selectedChatId = null;
|
||||
|
||||
await temporaryChatEnabled.set(false);
|
||||
await goto('/');
|
||||
const newChatButton = document.getElementById('new-chat-button');
|
||||
setTimeout(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user