mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac: chatlist skip, limit -> page
This commit is contained in:
@@ -26,8 +26,7 @@
|
||||
socket,
|
||||
showCallOverlay,
|
||||
tools,
|
||||
pageSkip,
|
||||
pageLimit
|
||||
currentChatPage
|
||||
} from '$lib/stores';
|
||||
import {
|
||||
convertMessagesToHistory,
|
||||
@@ -423,9 +422,9 @@
|
||||
params: params,
|
||||
files: chatFiles
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -471,9 +470,9 @@
|
||||
params: params,
|
||||
files: chatFiles
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -633,9 +632,9 @@
|
||||
tags: [],
|
||||
timestamp: Date.now()
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await chatId.set(chat.id);
|
||||
} else {
|
||||
await chatId.set('local');
|
||||
@@ -711,7 +710,8 @@
|
||||
})
|
||||
);
|
||||
|
||||
await chats.set(await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit));
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
|
||||
return _responses;
|
||||
};
|
||||
@@ -958,9 +958,9 @@
|
||||
params: params,
|
||||
files: chatFiles
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1227,9 +1227,9 @@
|
||||
params: params,
|
||||
files: chatFiles
|
||||
});
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1394,9 +1394,9 @@
|
||||
|
||||
if ($settings.saveChatHistory ?? true) {
|
||||
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
|
||||
await chats.set(
|
||||
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { chats, config, settings, user as _user, mobile, pageSkip, pageLimit } from '$lib/stores';
|
||||
import { chats, config, settings, user as _user, mobile, currentChatPage } from '$lib/stores';
|
||||
import { tick, getContext, onMount } from 'svelte';
|
||||
|
||||
import { toast } from 'svelte-sonner';
|
||||
@@ -90,7 +90,8 @@
|
||||
history: history
|
||||
});
|
||||
|
||||
await chats.set(await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit));
|
||||
currentChatPage.set(0);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
};
|
||||
|
||||
const confirmEditResponseMessage = async (messageId, content) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import fileSaver from 'file-saver';
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
import { chats, user, settings, scrollPaginationEnabled, pageSkip, pageLimit } from '$lib/stores';
|
||||
import { chats, user, settings, scrollPaginationEnabled } from '$lib/stores';
|
||||
|
||||
import {
|
||||
archiveAllChats,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
getTagsById,
|
||||
updateChatById
|
||||
} from '$lib/apis/chats';
|
||||
import { tags as _tags, chats, pinnedChats, pageSkip, pageLimit } from '$lib/stores';
|
||||
import { tags as _tags, chats, pinnedChats, currentChatPage } from '$lib/stores';
|
||||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -61,9 +61,8 @@
|
||||
} else {
|
||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||
enablePagination();
|
||||
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