🗨️ fix: Prompts Pagination (#9385)

* 🗨️ fix: Prompts Pagination

* ci: Simplify user middleware setup in prompt tests
This commit is contained in:
Danny Avila 2025-08-30 15:58:49 -04:00 committed by GitHub
parent 3a47deac07
commit 460eac36f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 536 additions and 237 deletions

View file

@ -21,9 +21,12 @@ export function formatPromptGroupsResponse({
hasMore?: boolean;
after?: string | null;
}): PromptGroupsListResponse {
const effectivePageSize = parseInt(pageSize || '') || parseInt(String(actualLimit || '')) || 10;
const totalPages =
promptGroups.length > 0 ? Math.ceil(promptGroups.length / effectivePageSize).toString() : '0';
const currentPage = parseInt(pageNumber || '1');
// Calculate total pages based on whether there are more results
// If hasMore is true, we know there's at least one more page
// We use a high number (9999) to indicate "many pages" since we don't know the exact count
const totalPages = hasMore ? '9999' : currentPage.toString();
return {
promptGroups,