chore: initial snapshot for gitea/github upload
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
Return the proxy base url and server root path, so UI can construct the correct url to access the proxy.
|
||||
|
||||
This is useful when the proxy is deployed at a different path than the root of the domain.
|
||||
|
||||
## How to use
|
||||
|
||||
**Action** Route the `/litellm` path to the proxy.
|
||||
|
||||
**Result** The UI will call `/litellm/.well-known/litellm-ui-config` to get the proxy base url and server root path.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from .ui_discovery_endpoints import router as ui_discovery_endpoints_router
|
||||
|
||||
__all__ = ["ui_discovery_endpoints_router"]
|
||||
@@ -0,0 +1,36 @@
|
||||
#### Analytics Endpoints #####
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from litellm.types.proxy.discovery_endpoints.ui_discovery_endpoints import (
|
||||
UiDiscoveryEndpoints,
|
||||
)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/.well-known/litellm-ui-config", response_model=UiDiscoveryEndpoints)
|
||||
@router.get(
|
||||
"/litellm/.well-known/litellm-ui-config", response_model=UiDiscoveryEndpoints
|
||||
) # if mounted at root path
|
||||
async def get_ui_config():
|
||||
from litellm.proxy.auth.auth_utils import _has_user_setup_sso
|
||||
from litellm.proxy.utils import get_proxy_base_url, get_server_root_path
|
||||
|
||||
from litellm.proxy.proxy_server import general_settings
|
||||
|
||||
auto_redirect_ui_login_to_sso = (
|
||||
os.getenv("AUTO_REDIRECT_UI_LOGIN_TO_SSO", "false").lower() == "true"
|
||||
or general_settings.get("auto_redirect_ui_login_to_sso", False) is True
|
||||
)
|
||||
admin_ui_disabled = os.getenv("DISABLE_ADMIN_UI", "false").lower() == "true"
|
||||
|
||||
sso_configured = _has_user_setup_sso()
|
||||
return UiDiscoveryEndpoints(
|
||||
server_root_path=get_server_root_path(),
|
||||
proxy_base_url=get_proxy_base_url(),
|
||||
auto_redirect_to_sso=sso_configured and auto_redirect_ui_login_to_sso,
|
||||
admin_ui_disabled=admin_ui_disabled,
|
||||
sso_configured=sso_configured,
|
||||
)
|
||||
Reference in New Issue
Block a user