Skip to content

Commit

Permalink
(fix) ui - don't fail when no DB connected
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed Feb 3, 2024
1 parent ed048fb commit ebb221f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3187,9 +3187,16 @@ async def login(request: Request):
):
user_id = username
# User is Authe'd in - generate key for the UI to access Proxy
response = await generate_key_helper_fn(
**{"duration": "1hr", "key_max_budget": 0, "models": [], "aliases": {}, "config": {}, "spend": 0, "user_id": user_id, "team_id": "litellm-dashboard"} # type: ignore
)

if os.getenv("DATABASE_URL") is not None:
response = await generate_key_helper_fn(
**{"duration": "1hr", "key_max_budget": 0, "models": [], "aliases": {}, "config": {}, "spend": 0, "user_id": user_id, "team_id": "litellm-dashboard"} # type: ignore
)
else:
response = {
"token": "sk-gm",
"user_id": "litellm-dashboard",
}

key = response["token"] # type: ignore
user_id = response["user_id"] # type: ignore
Expand Down

0 comments on commit ebb221f

Please sign in to comment.