mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix(proxy_server.py): fix merge errors
This commit is contained in:
parent
cf588a97fe
commit
605cfecf27
1 changed files with 11 additions and 18 deletions
|
@ -910,27 +910,20 @@ async def update_database(
|
||||||
max_budget=max_user_budget,
|
max_budget=max_user_budget,
|
||||||
user_email=None,
|
user_email=None,
|
||||||
)
|
)
|
||||||
if existing_spend_obj is None:
|
else:
|
||||||
existing_spend = 0
|
existing_spend = existing_spend_obj.spend
|
||||||
existing_spend_obj = LiteLLM_UserTable(
|
|
||||||
user_id=id, spend=0, max_budget=None, user_email=None
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
existing_spend = existing_spend_obj.spend
|
|
||||||
|
|
||||||
# Calculate the new cost by adding the existing cost and response_cost
|
# Calculate the new cost by adding the existing cost and response_cost
|
||||||
existing_spend_obj.spend = existing_spend + response_cost
|
existing_spend_obj.spend = existing_spend + response_cost
|
||||||
|
|
||||||
valid_token = user_api_key_cache.get_cache(key=id)
|
valid_token = user_api_key_cache.get_cache(key=id)
|
||||||
if valid_token is not None and isinstance(valid_token, dict):
|
if valid_token is not None and isinstance(valid_token, dict):
|
||||||
user_api_key_cache.set_cache(
|
user_api_key_cache.set_cache(
|
||||||
key=id, value=existing_spend_obj.json()
|
key=id, value=existing_spend_obj.json()
|
||||||
)
|
|
||||||
|
|
||||||
verbose_proxy_logger.debug(
|
|
||||||
f"new cost: {existing_spend_obj.spend}"
|
|
||||||
)
|
)
|
||||||
data_list.append(existing_spend_obj)
|
|
||||||
|
verbose_proxy_logger.debug(f"new cost: {existing_spend_obj.spend}")
|
||||||
|
data_list.append(existing_spend_obj)
|
||||||
|
|
||||||
# Update the cost column for the given user id
|
# Update the cost column for the given user id
|
||||||
if prisma_client is not None:
|
if prisma_client is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue