mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Merge pull request #2255 from BerriAI/litellm_admin_ui_user_panel_load_time_high
[FEAT] proxy add pagination on /user/info endpoint (Admin UI does not load all users)
This commit is contained in:
commit
e044d6332f
4 changed files with 91 additions and 8 deletions
|
@ -4329,6 +4329,14 @@ async def user_info(
|
|||
default=False,
|
||||
description="set to true to View all users. When using view_all, don't pass user_id",
|
||||
),
|
||||
page: Optional[int] = fastapi.Query(
|
||||
default=0,
|
||||
description="Page number for pagination. Only use when view_all is true",
|
||||
),
|
||||
page_size: Optional[int] = fastapi.Query(
|
||||
default=25,
|
||||
description="Number of items per page. Only use when view_all is true",
|
||||
),
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||
):
|
||||
"""
|
||||
|
@ -4350,8 +4358,14 @@ async def user_info(
|
|||
if user_id is not None:
|
||||
user_info = await prisma_client.get_data(user_id=user_id)
|
||||
elif view_all == True:
|
||||
if page is None:
|
||||
page = 0
|
||||
if page_size is None:
|
||||
page_size = 25
|
||||
offset = (page) * page_size # default is 0
|
||||
limit = page_size # default is 10
|
||||
user_info = await prisma_client.get_data(
|
||||
table_name="user", query_type="find_all"
|
||||
table_name="user", query_type="find_all", offset=offset, limit=limit
|
||||
)
|
||||
return user_info
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue