fix(config): return full URLs for backend and LangGraph base URLs (#1392)

This commit is contained in:
JeffJiang
2026-03-26 15:43:37 +08:00
committed by GitHub
parent a087fe7bcc
commit 4d1a69a938

View File

@@ -2,7 +2,10 @@ import { env } from "@/env";
export function getBackendBaseURL() {
if (env.NEXT_PUBLIC_BACKEND_BASE_URL) {
return env.NEXT_PUBLIC_BACKEND_BASE_URL;
return new URL(
env.NEXT_PUBLIC_BACKEND_BASE_URL,
window.location.origin,
).toString();
} else {
return "";
}
@@ -10,7 +13,10 @@ export function getBackendBaseURL() {
export function getLangGraphBaseURL(isMock?: boolean) {
if (env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) {
return env.NEXT_PUBLIC_LANGGRAPH_BASE_URL;
return new URL(
env.NEXT_PUBLIC_LANGGRAPH_BASE_URL,
window.location.origin,
).toString();
} else if (isMock) {
if (typeof window !== "undefined") {
return `${window.location.origin}/mock/api`;