mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix(admins.tsx): fix logic for getting base url and create common get base url component (#7854)
Resolves https://github.com/BerriAI/litellm/issues/7761
This commit is contained in:
parent
00594871a4
commit
762d872b7e
5 changed files with 26 additions and 19 deletions
|
@ -42,6 +42,8 @@ interface AdminPanelProps {
|
|||
showSSOBanner: boolean;
|
||||
premiumUser: boolean;
|
||||
}
|
||||
import { useBaseUrl } from "./constants";
|
||||
|
||||
|
||||
import {
|
||||
userUpdateUserCall,
|
||||
|
@ -94,18 +96,11 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
|||
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 = "<your-proxy-url>";
|
||||
}
|
||||
let nonSssoUrl = baseUrl;
|
||||
nonSssoUrl += "/fallback/login";
|
||||
|
||||
const handleShowAllowedIPs = async () => {
|
||||
|
@ -202,13 +197,13 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue