mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(feat) return team alias in keys
This commit is contained in:
parent
7f793246c2
commit
beb72f94e0
1 changed files with 5 additions and 2 deletions
|
@ -5282,6 +5282,7 @@ async def user_info(
|
||||||
user_info = {"spend": spend}
|
user_info = {"spend": spend}
|
||||||
|
|
||||||
## REMOVE HASHED TOKEN INFO before returning ##
|
## REMOVE HASHED TOKEN INFO before returning ##
|
||||||
|
returned_keys = []
|
||||||
for key in keys:
|
for key in keys:
|
||||||
try:
|
try:
|
||||||
key = key.model_dump() # noqa
|
key = key.model_dump() # noqa
|
||||||
|
@ -5298,14 +5299,16 @@ async def user_info(
|
||||||
team_info = await prisma_client.get_data(
|
team_info = await prisma_client.get_data(
|
||||||
team_id=key["team_id"], table_name="team"
|
team_id=key["team_id"], table_name="team"
|
||||||
)
|
)
|
||||||
key["team_alias"] = team_info["team_alias"]
|
team_alias = getattr(team_info, "team_alias", None)
|
||||||
|
key["team_alias"] = team_alias
|
||||||
else:
|
else:
|
||||||
key["team_alias"] = "None"
|
key["team_alias"] = "None"
|
||||||
|
returned_keys.append(key)
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
"user_info": user_info,
|
"user_info": user_info,
|
||||||
"keys": keys,
|
"keys": returned_keys,
|
||||||
"teams": team_list,
|
"teams": team_list,
|
||||||
}
|
}
|
||||||
return response_data
|
return response_data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue