Merge pull request #1843 from BerriAI/litellm_admin_ui_view_all_keys

feat(ui): enable admin to view all valid keys created on the proxy
This commit is contained in:
Krish Dholakia 2024-02-06 22:06:46 -08:00 committed by GitHub
commit 2bc710d8e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 331 additions and 229 deletions

View file

@ -565,9 +565,20 @@ class PrismaClient:
# The asterisk before `user_id_list` unpacks the list into separate arguments
response = await self.db.query_raw(sql_query)
elif query_type == "find_all":
response = await self.db.litellm_usertable.find_many( # type: ignore
order={"spend": "desc"},
)
if expires is not None:
response = await self.db.litellm_usertable.find_many( # type: ignore
order={"spend": "desc"},
where={ # type:ignore
"OR": [
{"expires": None}, # type:ignore
{"expires": {"gt": expires}}, # type:ignore
],
},
)
else:
response = await self.db.litellm_usertable.find_many( # type: ignore
order={"spend": "desc"},
)
return response
elif table_name == "spend":
verbose_proxy_logger.debug(