mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
feat(ui_sso.py): allows ui to call correct endpoint
This commit is contained in:
parent
b4393c0fdf
commit
c8240c41df
4 changed files with 17 additions and 2 deletions
|
|
@ -59,7 +59,7 @@ from litellm.proxy.management_endpoints.sso_helper_utils import (
|
|||
)
|
||||
from litellm.proxy.management_endpoints.team_endpoints import new_team, team_member_add
|
||||
from litellm.proxy.management_endpoints.types import CustomOpenID
|
||||
from litellm.proxy.utils import PrismaClient, ProxyLogging
|
||||
from litellm.proxy.utils import PrismaClient, ProxyLogging, get_server_root_path
|
||||
from litellm.secret_managers.main import get_secret_bool, str_to_bool
|
||||
from litellm.types.proxy.management_endpoints.ui_sso import *
|
||||
|
||||
|
|
@ -670,6 +670,7 @@ async def auth_callback(request: Request): # noqa: PLR0915
|
|||
"litellm_key_header_name", "Authorization"
|
||||
),
|
||||
disabled_non_admin_personal_key_creation=disabled_non_admin_personal_key_creation,
|
||||
server_root_path=get_server_root_path(),
|
||||
)
|
||||
|
||||
jwt_token = jwt.encode( # type: ignore
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@ from litellm.proxy.utils import (
|
|||
_is_valid_team_configs,
|
||||
get_custom_url,
|
||||
get_error_message_str,
|
||||
get_server_root_path,
|
||||
hash_token,
|
||||
update_spend,
|
||||
)
|
||||
|
|
@ -6754,6 +6755,7 @@ async def login(request: Request): # noqa: PLR0915
|
|||
"litellm_key_header_name", "Authorization"
|
||||
),
|
||||
disabled_non_admin_personal_key_creation=disabled_non_admin_personal_key_creation,
|
||||
server_root_path=get_server_root_path(),
|
||||
)
|
||||
|
||||
jwt_token = jwt.encode( # type: ignore
|
||||
|
|
@ -6832,6 +6834,7 @@ async def login(request: Request): # noqa: PLR0915
|
|||
"litellm_key_header_name", "Authorization"
|
||||
),
|
||||
disabled_non_admin_personal_key_creation=disabled_non_admin_personal_key_creation,
|
||||
server_root_path=get_server_root_path(),
|
||||
)
|
||||
|
||||
jwt_token = jwt.encode( # type: ignore
|
||||
|
|
@ -6966,6 +6969,7 @@ async def onboarding(invite_link: str, request: Request):
|
|||
"litellm_key_header_name", "Authorization"
|
||||
),
|
||||
disabled_non_admin_personal_key_creation=disabled_non_admin_personal_key_creation,
|
||||
server_root_path=get_server_root_path(),
|
||||
)
|
||||
jwt_token = jwt.encode( # type: ignore
|
||||
cast(dict, returned_ui_token_object),
|
||||
|
|
|
|||
|
|
@ -2863,3 +2863,13 @@ def get_custom_url(request_base_url: str) -> str:
|
|||
ui_link = str(URL(request_base_url).join(server_root_path))
|
||||
|
||||
return ui_link
|
||||
|
||||
|
||||
def get_server_root_path() -> str:
|
||||
"""
|
||||
Get the server root path from the environment variables.
|
||||
|
||||
- If SERVER_ROOT_PATH is set, return it.
|
||||
- Otherwise, default to "/".
|
||||
"""
|
||||
return os.getenv("SERVER_ROOT_PATH", "/")
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@ class ReturnedUITokenObject(TypedDict):
|
|||
premium_user: bool
|
||||
auth_header_name: str
|
||||
disabled_non_admin_personal_key_creation: bool
|
||||
server_root_path: str
|
||||
server_root_path: str # e.g. `/litellm`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue