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