fix(proxy_server.py): fix handling none value for existing spend object pt.2

This commit is contained in:
Krrish Dholakia 2024-01-24 20:39:00 -08:00
parent 12b2ad9ed1
commit 34c4532e7e
2 changed files with 4 additions and 2 deletions

View file

@ -329,7 +329,7 @@ class LiteLLM_UserTable(LiteLLMBase):
if values.get("spend") is None: if values.get("spend") is None:
values.update({"spend": 0.0}) values.update({"spend": 0.0})
if values.get("models") is None: if values.get("models") is None:
values.update({"models", []}) values.update({"models": []})
return values return values

View file

@ -692,7 +692,9 @@ async def update_database(
) )
if existing_spend_obj is None: if existing_spend_obj is None:
existing_spend = 0 existing_spend = 0
existing_spend = LiteLLM_UserTable(user_id=id, spend=0) existing_spend_obj = LiteLLM_UserTable(
user_id=id, spend=0, max_budget=None, user_email=None
)
else: else:
existing_spend = existing_spend_obj.spend existing_spend = existing_spend_obj.spend