mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-03 06:12:14 +08:00
fix: refactor to use getBaseOrigin for URL construction in backend and LangGraph base URL functions (#1494)
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { env } from "@/env";
|
||||
|
||||
function getBaseOrigin() {
|
||||
if (typeof window !== "undefined") {
|
||||
return window.location.origin;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getBackendBaseURL() {
|
||||
if (env.NEXT_PUBLIC_BACKEND_BASE_URL) {
|
||||
return new URL(
|
||||
env.NEXT_PUBLIC_BACKEND_BASE_URL,
|
||||
window.location.origin,
|
||||
getBaseOrigin(),
|
||||
).toString();
|
||||
} else {
|
||||
return "";
|
||||
@@ -15,7 +23,7 @@ export function getLangGraphBaseURL(isMock?: boolean) {
|
||||
if (env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) {
|
||||
return new URL(
|
||||
env.NEXT_PUBLIC_LANGGRAPH_BASE_URL,
|
||||
window.location.origin,
|
||||
getBaseOrigin(),
|
||||
).toString();
|
||||
} else if (isMock) {
|
||||
if (typeof window !== "undefined") {
|
||||
|
||||
Reference in New Issue
Block a user