refac: chatlist skip, limit -> page

This commit is contained in:
Timothy J. Baek
2024-08-04 16:58:08 +02:00
parent a2f9f7c975
commit a084938d9c
10 changed files with 72 additions and 74 deletions
+7 -2
View File
@@ -32,10 +32,15 @@ export const createNewChat = async (token: string, chat: object) => {
return res;
};
export const getChatList = async (token: string = '', skip: number = 0, limit: number = -1) => {
export const getChatList = async (token: string = '', page: number | null = null) => {
let error = null;
const searchParams = new URLSearchParams();
const res = await fetch(`${WEBUI_API_BASE_URL}/chats/?skip=${skip}&limit=${limit}`, {
if (page !== null) {
searchParams.append('page', `${page}`);
}
const res = await fetch(`${WEBUI_API_BASE_URL}/chats/?${searchParams.toString()}`, {
method: 'GET',
headers: {
Accept: 'application/json',