forked from phoenix/litellm-mirror
fix(proxy_server.py): support checking openai user param
This commit is contained in:
parent
7924700df6
commit
b3493269b3
2 changed files with 41 additions and 5 deletions
|
@ -66,12 +66,13 @@ class _ENTERPRISE_BlockedUserList(CustomLogger):
|
|||
- check if user id part of blocked list
|
||||
"""
|
||||
self.print_verbose(f"Inside Blocked User List Pre-Call Hook")
|
||||
if "user_id" in data:
|
||||
if data["user_id"] in self.blocked_user_list:
|
||||
if "user_id" in data or "user" in data:
|
||||
user = data.get("user_id", data.get("user", ""))
|
||||
if user in self.blocked_user_list:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail={
|
||||
"error": f"User blocked from making LLM API Calls. User={data['user_id']}"
|
||||
"error": f"User blocked from making LLM API Calls. User={user}"
|
||||
},
|
||||
)
|
||||
except HTTPException as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue