mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
Merge pull request #9395 from BerriAI/litellm_ui_fixes_03_19_2025
fix(internal_user_endpoints.py): re-introduce upsert on user not found
This commit is contained in:
commit
7cf7e80c5a
2 changed files with 9 additions and 7 deletions
|
@ -8,7 +8,6 @@ model_list:
|
|||
|
||||
litellm_settings:
|
||||
num_retries: 0
|
||||
callbacks: ["otel"]
|
||||
|
||||
router_settings:
|
||||
routing_strategy: usage-based-routing-v2 # 👈 KEY CHANGE
|
||||
|
|
|
@ -737,13 +737,16 @@ async def user_update(
|
|||
existing_user_row = await prisma_client.db.litellm_usertable.find_first(
|
||||
where={"user_id": data.user_id}
|
||||
)
|
||||
if existing_user_row is None:
|
||||
raise Exception(f"User not found, passed user_id={data.user_id}")
|
||||
if existing_user_row is not None:
|
||||
existing_user_row = LiteLLM_UserTable(
|
||||
**existing_user_row.model_dump(exclude_none=True)
|
||||
)
|
||||
|
||||
existing_metadata = cast(Dict, getattr(existing_user_row, "metadata", {}) or {})
|
||||
existing_metadata = (
|
||||
cast(Dict, getattr(existing_user_row, "metadata", {}) or {})
|
||||
if existing_user_row is not None
|
||||
else {}
|
||||
)
|
||||
|
||||
non_default_values = prepare_metadata_fields(
|
||||
data=data,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue