fix send emails to team members

This commit is contained in:
Ishaan Jaff 2024-06-14 20:11:16 -07:00
parent 408899dac8
commit 09b1d52ea1
2 changed files with 49 additions and 43 deletions

View file

@ -2,6 +2,7 @@ from datetime import datetime
from functools import wraps
from litellm.proxy._types import UserAPIKeyAuth, ManagementEndpointLoggingPayload
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
from litellm._logging import verbose_logger
from fastapi import Request
@ -20,7 +21,7 @@ def management_endpoint_wrapper(func):
try:
result = await func(*args, **kwargs)
end_time = datetime.now()
try:
if kwargs is None:
kwargs = {}
user_api_key_dict: UserAPIKeyAuth = (
@ -51,6 +52,7 @@ def management_endpoint_wrapper(func):
logging_payload=logging_payload,
parent_otel_span=parent_otel_span,
)
if _http_request:
_route = _http_request.url.path
# Flush user_api_key cache if this was an update/delete call to /key, /team, or /user
@ -67,6 +69,10 @@ def management_endpoint_wrapper(func):
from litellm.proxy.proxy_server import user_api_key_cache
user_api_key_cache.flush_cache()
except Exception as e:
# Non-Blocking Exception
verbose_logger.debug("Error in management endpoint wrapper: %s", str(e))
pass
return result
except Exception as e:

View file

@ -8915,7 +8915,7 @@ async def new_user(data: NewUserRequest):
),
),
http_request=Request(
scope={"type": "http"},
scope={"type": "http", "path": "/user/new"},
),
)