mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-16 23:07:14 +00:00
fix(web): complete pluginized agent onboarding flows
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export function resolveBackendBaseUrl(
|
||||
configuredBaseUrl: string | undefined,
|
||||
origin: string,
|
||||
): string {
|
||||
const normalizedOrigin = origin.replace(/\/+$/, '');
|
||||
const configured = configuredBaseUrl?.trim() ?? '';
|
||||
|
||||
if (!configured || configured === '/') {
|
||||
return normalizedOrigin;
|
||||
}
|
||||
|
||||
if (/^https?:\/\//i.test(configured)) {
|
||||
return configured.replace(/\/+$/, '');
|
||||
}
|
||||
|
||||
return `${normalizedOrigin}/${configured.replace(/^\/+|\/+$/g, '')}`;
|
||||
}
|
||||
|
||||
export function getBackendBaseUrl(): string {
|
||||
return resolveBackendBaseUrl(
|
||||
import.meta.env.VITE_API_BASE_URL,
|
||||
window.location.origin,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user