mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
refac: chatlist skip, limit -> page
This commit is contained in:
@@ -14,15 +14,7 @@
|
||||
getChatListByTagName,
|
||||
updateChatById
|
||||
} from '$lib/apis/chats';
|
||||
import {
|
||||
chatId,
|
||||
chats,
|
||||
mobile,
|
||||
pageSkip,
|
||||
pageLimit,
|
||||
pinnedChats,
|
||||
showSidebar
|
||||
} from '$lib/stores';
|
||||
import { chatId, chats, mobile, pinnedChats, showSidebar, currentChatPage } from '$lib/stores';
|
||||
|
||||
import ChatMenu from './ChatMenu.svelte';
|
||||
import ShareChatModal from '$lib/components/chat/ShareChatModal.svelte';
|
||||
@@ -48,9 +40,9 @@
|
||||
await updateChatById(localStorage.token, id, {
|
||||
title: _title
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
}
|
||||
};
|
||||
@@ -63,16 +55,18 @@
|
||||
|
||||
if (res) {
|
||||
goto(`/c/${res.id}`);
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
}
|
||||
};
|
||||
|
||||
const archiveChatHandler = async (id) => {
|
||||
await archiveChatById(localStorage.token, id);
|
||||
await chats.set(await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit));
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user