mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import fileSaver from 'file-saver';
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
import { chats, user, settings, scrollPaginationEnabled } from '$lib/stores';
|
||||
import { chats, user, settings, scrollPaginationEnabled, currentChatPage } from '$lib/stores';
|
||||
|
||||
import {
|
||||
archiveAllChats,
|
||||
@@ -12,12 +12,7 @@
|
||||
getAllUserChats,
|
||||
getChatList
|
||||
} from '$lib/apis/chats';
|
||||
import {
|
||||
getImportOrigin,
|
||||
convertOpenAIChats,
|
||||
disablePagination,
|
||||
enablePagination
|
||||
} from '$lib/utils';
|
||||
import { getImportOrigin, convertOpenAIChats } from '$lib/utils';
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { toast } from 'svelte-sonner';
|
||||
@@ -66,7 +61,10 @@
|
||||
await createNewChat(localStorage.token, chat);
|
||||
}
|
||||
}
|
||||
enablePagination();
|
||||
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
scrollPaginationEnabled.set(true);
|
||||
};
|
||||
|
||||
const exportChats = async () => {
|
||||
@@ -81,7 +79,10 @@
|
||||
await archiveAllChats(localStorage.token).catch((error) => {
|
||||
toast.error(error);
|
||||
});
|
||||
enablePagination();
|
||||
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
scrollPaginationEnabled.set(true);
|
||||
};
|
||||
|
||||
const deleteAllChatsHandler = async () => {
|
||||
@@ -90,7 +91,9 @@
|
||||
toast.error(error);
|
||||
});
|
||||
|
||||
enablePagination();
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
scrollPaginationEnabled.set(true);
|
||||
};
|
||||
|
||||
const toggleSaveChatHistory = async () => {
|
||||
|
||||
@@ -8,13 +8,18 @@
|
||||
getTagsById,
|
||||
updateChatById
|
||||
} from '$lib/apis/chats';
|
||||
import { tags as _tags, chats, pinnedChats, currentChatPage } from '$lib/stores';
|
||||
import {
|
||||
tags as _tags,
|
||||
chats,
|
||||
pinnedChats,
|
||||
currentChatPage,
|
||||
scrollPaginationEnabled
|
||||
} from '$lib/stores';
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
import Tags from '../common/Tags.svelte';
|
||||
import { enablePagination } from '$lib/utils';
|
||||
|
||||
export let chatId = '';
|
||||
let tags = [];
|
||||
@@ -60,10 +65,10 @@
|
||||
}
|
||||
} else {
|
||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||
enablePagination();
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
await scrollPaginationEnabled.set(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user