mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-24 22:44:50 -06:00
refac
This commit is contained in:
@@ -2632,12 +2632,8 @@
|
||||
currentChatPage.set(1);
|
||||
initNewChat();
|
||||
await goto('/');
|
||||
getChatList(localStorage.token, $currentChatPage).then((chats) => {
|
||||
chats.set(chats);
|
||||
});
|
||||
getPinnedChatList(localStorage.token).then((pinnedChats) => {
|
||||
pinnedChats.set(pinnedChats);
|
||||
});
|
||||
chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
pinnedChats.set(await getPinnedChatList(localStorage.token));
|
||||
toast.success($i18n.t('Chat archived.'));
|
||||
} catch (error) {
|
||||
console.error('Error archiving chat:', error);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
export let show = false;
|
||||
export let onUpdate = () => {};
|
||||
export let onDelete: (id: string) => void = () => {};
|
||||
|
||||
let loading = false;
|
||||
let chatList: any[] | null = null;
|
||||
@@ -158,6 +159,9 @@
|
||||
onUpdate={() => {
|
||||
init();
|
||||
}}
|
||||
onDelete={(id) => {
|
||||
onDelete(id);
|
||||
}}
|
||||
loadHandler={loadMoreChats}
|
||||
{unarchiveHandler}
|
||||
>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
let showDeleteConfirmDialog = false;
|
||||
|
||||
export let onUpdate = () => {};
|
||||
export let onDelete: (id: string) => void = () => {};
|
||||
|
||||
export let loadHandler: null | Function = null;
|
||||
export let unarchiveHandler: null | Function = null;
|
||||
@@ -69,6 +70,9 @@
|
||||
toast.error(`${error}`);
|
||||
});
|
||||
|
||||
if (res) {
|
||||
onDelete(chatId);
|
||||
}
|
||||
onUpdate();
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -592,6 +592,12 @@
|
||||
onUpdate={async () => {
|
||||
await initChatList();
|
||||
}}
|
||||
onDelete={(id) => {
|
||||
if ($chatId === id) {
|
||||
chatId.set('');
|
||||
window.history.replaceState({}, '', '/');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<ChannelModal
|
||||
|
||||
@@ -155,6 +155,12 @@
|
||||
const archiveChatHandler = async (id) => {
|
||||
try {
|
||||
await archiveChatById(localStorage.token, id);
|
||||
|
||||
if ($chatId === id) {
|
||||
chatId.set('');
|
||||
window.history.replaceState({}, '', '/');
|
||||
}
|
||||
|
||||
dispatch('change');
|
||||
toast.success($i18n.t('Chat archived.'));
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user