mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix send emails to team members
This commit is contained in:
parent
408899dac8
commit
09b1d52ea1
2 changed files with 49 additions and 43 deletions
|
@ -2,6 +2,7 @@ from datetime import datetime
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from litellm.proxy._types import UserAPIKeyAuth, ManagementEndpointLoggingPayload
|
from litellm.proxy._types import UserAPIKeyAuth, ManagementEndpointLoggingPayload
|
||||||
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
|
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
|
||||||
|
from litellm._logging import verbose_logger
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ def management_endpoint_wrapper(func):
|
||||||
try:
|
try:
|
||||||
result = await func(*args, **kwargs)
|
result = await func(*args, **kwargs)
|
||||||
end_time = datetime.now()
|
end_time = datetime.now()
|
||||||
|
try:
|
||||||
if kwargs is None:
|
if kwargs is None:
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
user_api_key_dict: UserAPIKeyAuth = (
|
user_api_key_dict: UserAPIKeyAuth = (
|
||||||
|
@ -51,6 +52,7 @@ def management_endpoint_wrapper(func):
|
||||||
logging_payload=logging_payload,
|
logging_payload=logging_payload,
|
||||||
parent_otel_span=parent_otel_span,
|
parent_otel_span=parent_otel_span,
|
||||||
)
|
)
|
||||||
|
|
||||||
if _http_request:
|
if _http_request:
|
||||||
_route = _http_request.url.path
|
_route = _http_request.url.path
|
||||||
# Flush user_api_key cache if this was an update/delete call to /key, /team, or /user
|
# 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
|
from litellm.proxy.proxy_server import user_api_key_cache
|
||||||
|
|
||||||
user_api_key_cache.flush_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
|
return result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -8915,7 +8915,7 @@ async def new_user(data: NewUserRequest):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
http_request=Request(
|
http_request=Request(
|
||||||
scope={"type": "http"},
|
scope={"type": "http", "path": "/user/new"},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue