diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html deleted file mode 100644 index 03d4e13c556..00000000000 --- a/litellm/proxy/_experimental/out/404.html +++ /dev/null @@ -1 +0,0 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/model_hub.html b/litellm/proxy/_experimental/out/model_hub.html deleted file mode 100644 index b30d16fff84..00000000000 --- a/litellm/proxy/_experimental/out/model_hub.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html deleted file mode 100644 index 3ab72ec5024..00000000000 --- a/litellm/proxy/_experimental/out/onboarding.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/admins.tsx b/ui/litellm-dashboard/src/components/admins.tsx index f226d1c1141..32fd0f2865c 100644 --- a/ui/litellm-dashboard/src/components/admins.tsx +++ b/ui/litellm-dashboard/src/components/admins.tsx @@ -42,6 +42,8 @@ interface AdminPanelProps { showSSOBanner: boolean; premiumUser: boolean; } +import { useBaseUrl } from "./constants"; + import { userUpdateUserCall, @@ -94,18 +96,11 @@ const AdminPanel: React.FC = ({ if (isLocal != true) { console.log = function() {}; } - const [baseUrl, setBaseUrl] = useState( - isLocal ? "http://localhost:4000" : "" - ); + const baseUrl = useBaseUrl(); const all_ip_address_allowed = "All IP Addresses Allowed"; - let nonSssoUrl; - try { - nonSssoUrl = window.location.origin; - } catch (error) { - nonSssoUrl = ""; - } + let nonSssoUrl = baseUrl; nonSssoUrl += "/fallback/login"; const handleShowAllowedIPs = async () => { @@ -202,13 +197,13 @@ const AdminPanel: React.FC = ({ const roles = ["proxy_admin", "proxy_admin_viewer"]; - useEffect(() => { - if (router) { - const { protocol, host } = window.location; - const baseUrl = `${protocol}//${host}`; - setBaseUrl(baseUrl); - } - }, [router]); + // useEffect(() => { + // if (router) { + // const { protocol, host } = window.location; + // const baseUrl = `${protocol}//${host}`; + // setBaseUrl(baseUrl); + // } + // }, [router]); useEffect(() => { // Fetch model info and set the default selected model diff --git a/ui/litellm-dashboard/src/components/constants.tsx b/ui/litellm-dashboard/src/components/constants.tsx new file mode 100644 index 00000000000..81ba55784a2 --- /dev/null +++ b/ui/litellm-dashboard/src/components/constants.tsx @@ -0,0 +1,15 @@ +// useBaseUrl.ts +import { useState, useEffect } from 'react'; + +export const useBaseUrl = () => { + const [baseUrl, setBaseUrl] = useState("http://localhost:4000"); + + useEffect(() => { + if (typeof window !== 'undefined') { + const { protocol, host } = window.location; + setBaseUrl(`${protocol}//${host}`); + } + }, []); // Removed router dependency + + return baseUrl; +}; \ No newline at end of file