mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(internal_user_endpoints.py): re-introduce upsert on user not found
Fixes https://github.com/BerriAI/litellm/issues/9243
This commit is contained in:
parent
220aa66f98
commit
07b1e6aa1c
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}")
|
||||
existing_user_row = LiteLLM_UserTable(
|
||||
**existing_user_row.model_dump(exclude_none=True)
|
||||
)
|
||||
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
Reference in a new issue