mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix req changes
This commit is contained in:
parent
e2276c2341
commit
350e2d8c55
3 changed files with 21 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
||||
|
||||
from litellm._logging import verbose_proxy_logger
|
||||
from litellm.caching import DualCache
|
||||
|
|
|
|||
|
|
@ -1960,6 +1960,25 @@ async def update_key_fn(
|
|||
prisma_client=prisma_client,
|
||||
)
|
||||
|
||||
# Step 6d: Key update validation against effective models
|
||||
if data.models is not None and (data.team_id or existing_key_row.team_id):
|
||||
team_id_to_check = data.team_id or existing_key_row.team_id
|
||||
if team_obj is None or team_obj.team_id != team_id_to_check:
|
||||
team_obj = await get_team_object(
|
||||
team_id=team_id_to_check,
|
||||
prisma_client=prisma_client,
|
||||
user_api_key_cache=user_api_key_cache,
|
||||
check_db_only=True,
|
||||
)
|
||||
if team_obj is not None:
|
||||
await _validate_key_models_against_effective_team_models(
|
||||
team_id=team_id_to_check,
|
||||
user_id=data.user_id or existing_key_row.user_id,
|
||||
data=data,
|
||||
team_table=team_obj,
|
||||
prisma_client=prisma_client,
|
||||
)
|
||||
|
||||
# Validate key against project limits if project_id is being set
|
||||
_project_id_to_check = getattr(data, "project_id", None) or getattr(
|
||||
existing_key_row, "project_id", None
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ async def add_new_member(
|
|||
else:
|
||||
_budget_id = default_team_budget_id
|
||||
|
||||
if returned_user is not None and returned_user.user_id is not None:
|
||||
if (_budget_id or models) and returned_user is not None and returned_user.user_id is not None:
|
||||
create_data: Dict[str, Any] = {
|
||||
"team_id": team_id,
|
||||
"user_id": returned_user.user_id,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue