mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(onboarding_link.tsx): fix onboarding link when custom server path is set
This commit is contained in:
parent
53aae8f12a
commit
66ce04d9e9
2 changed files with 10 additions and 3 deletions
|
|
@ -62,7 +62,7 @@ const Createuser: React.FC<CreateuserProps> = ({
|
|||
useState(false);
|
||||
const [invitationLinkData, setInvitationLinkData] =
|
||||
useState<InvitationLink | null>(null);
|
||||
const baseUrl = getProxyBaseUrl();
|
||||
const [baseUrl, setBaseUrl] = useState<string | null>(null);
|
||||
// get all models
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
|
|
@ -95,6 +95,8 @@ const Createuser: React.FC<CreateuserProps> = ({
|
|||
}
|
||||
};
|
||||
|
||||
setBaseUrl(getProxyBaseUrl());
|
||||
|
||||
fetchData(); // Call the function to fetch model data when the component mounts
|
||||
}, []); // Empty dependency array to run only once
|
||||
|
||||
|
|
|
|||
|
|
@ -41,10 +41,15 @@ export default function OnboardingModal({
|
|||
};
|
||||
|
||||
const getInvitationUrl = () => {
|
||||
// Get the path from the base URL
|
||||
const baseUrlObj = new URL(baseUrl);
|
||||
const basePath = baseUrlObj.pathname; // This will be "/litellm" or whatever the path is
|
||||
|
||||
if (invitationLinkData?.has_user_setup_sso) {
|
||||
return new URL("/ui", baseUrl).toString();
|
||||
return new URL(`${basePath}/ui`, baseUrl).toString();
|
||||
}
|
||||
return new URL(`/ui?invitation_id=${invitationLinkData?.id}`, baseUrl).toString();
|
||||
const url = new URL(`${basePath}/ui?invitation_id=${invitationLinkData?.id}`, baseUrl).toString();
|
||||
return url;
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue