This commit is contained in:
Timothy J. Baek
2024-08-04 16:36:44 +02:00
parent 4441338574
commit a2f9f7c975
6 changed files with 87 additions and 72 deletions

View File

@@ -12,7 +12,12 @@
getAllUserChats,
getChatList
} from '$lib/apis/chats';
import { getImportOrigin, convertOpenAIChats, disablePagination } from '$lib/utils';
import {
getImportOrigin,
convertOpenAIChats,
disablePagination,
enablePagination
} from '$lib/utils';
import { onMount, getContext } from 'svelte';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
@@ -61,8 +66,7 @@
await createNewChat(localStorage.token, chat);
}
}
disablePagination();
await chats.set(await getChatList(localStorage.token));
enablePagination();
};
const exportChats = async () => {
@@ -77,8 +81,7 @@
await archiveAllChats(localStorage.token).catch((error) => {
toast.error(error);
});
disablePagination();
await chats.set(await getChatList(localStorage.token));
enablePagination();
};
const deleteAllChatsHandler = async () => {
@@ -86,8 +89,8 @@
await deleteAllChats(localStorage.token).catch((error) => {
toast.error(error);
});
disablePagination();
await chats.set(await getChatList(localStorage.token));
enablePagination();
};
const toggleSaveChatHistory = async () => {

View File

@@ -8,12 +8,13 @@
getTagsById,
updateChatById
} from '$lib/apis/chats';
import { tags as _tags, chats, pinnedChats, pageSkip, pageLimit, tagView } from '$lib/stores';
import { tags as _tags, chats, pinnedChats, pageSkip, pageLimit } 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 = [];
@@ -59,7 +60,7 @@
}
} else {
// if the tag we deleted is no longer a valid tag, return to main chat list view
tagView.set(false);
enablePagination();
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);