forked from phoenix/litellm-mirror
(fix) ui - don't fail when no DB connected
This commit is contained in:
parent
ed048fb822
commit
ebb221f743
1 changed files with 10 additions and 3 deletions
|
@ -3187,9 +3187,16 @@ async def login(request: Request):
|
||||||
):
|
):
|
||||||
user_id = username
|
user_id = username
|
||||||
# User is Authe'd in - generate key for the UI to access Proxy
|
# User is Authe'd in - generate key for the UI to access Proxy
|
||||||
|
|
||||||
|
if os.getenv("DATABASE_URL") is not None:
|
||||||
response = await generate_key_helper_fn(
|
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
|
**{"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
|
key = response["token"] # type: ignore
|
||||||
user_id = response["user_id"] # type: ignore
|
user_id = response["user_id"] # type: ignore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue