mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
🗨️ fix: Prompts Pagination (#9385)
* 🗨️ fix: Prompts Pagination
* ci: Simplify user middleware setup in prompt tests
This commit is contained in:
parent
3a47deac07
commit
460eac36f6
13 changed files with 536 additions and 237 deletions
|
|
@ -252,8 +252,19 @@ export const getPromptGroup = (_id: string) => `${prompts()}/groups/${_id}`;
|
|||
|
||||
export const getPromptGroupsWithFilters = (filter: object) => {
|
||||
let url = `${prompts()}/groups`;
|
||||
if (Object.keys(filter).length > 0) {
|
||||
const queryParams = new URLSearchParams(filter as Record<string, string>).toString();
|
||||
// Filter out undefined/null values
|
||||
const cleanedFilter = Object.entries(filter).reduce(
|
||||
(acc, [key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
acc[key] = value;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
);
|
||||
|
||||
if (Object.keys(cleanedFilter).length > 0) {
|
||||
const queryParams = new URLSearchParams(cleanedFilter).toString();
|
||||
url += `?${queryParams}`;
|
||||
}
|
||||
return url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue