mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-21 20:16:18 +00:00
- Updated documentation and comments to reflect the transition from LangGraph Server to Gateway. - Changed default URLs in ChannelManager and tests to point to Gateway. - Removed references to LangGraph Server in deployment scripts and configurations. - Updated Nginx configuration to route API traffic to Gateway. - Adjusted frontend configurations to utilize Gateway's API. - Removed LangGraph service from Docker Compose files, consolidating services under Gateway. - Added regression tests to ensure Gateway integration works as expected. Co-authored-by: Copilot <copilot@github.com>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { env } from "@/env";
|
|
|
|
function getBaseOrigin() {
|
|
if (typeof window !== "undefined") {
|
|
return window.location.origin;
|
|
}
|
|
// Fallback for SSR
|
|
return "http://localhost:2026";
|
|
}
|
|
|
|
export function getBackendBaseURL() {
|
|
if (env.NEXT_PUBLIC_BACKEND_BASE_URL) {
|
|
return new URL(env.NEXT_PUBLIC_BACKEND_BASE_URL, getBaseOrigin())
|
|
.toString()
|
|
.replace(/\/+$/, "");
|
|
} else {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
export function getLangGraphBaseURL(isMock?: boolean) {
|
|
console.log(
|
|
"env.NEXT_PUBLIC_LANGGRAPH_BASE_URL",
|
|
env.NEXT_PUBLIC_LANGGRAPH_BASE_URL,
|
|
);
|
|
if (env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) {
|
|
return new URL(
|
|
env.NEXT_PUBLIC_LANGGRAPH_BASE_URL,
|
|
getBaseOrigin(),
|
|
).toString();
|
|
} else if (isMock) {
|
|
if (typeof window !== "undefined") {
|
|
return `${window.location.origin}/mock/api`;
|
|
}
|
|
return "http://localhost:3000/mock/api";
|
|
} else {
|
|
// LangGraph SDK requires a full URL, construct it from current origin
|
|
if (typeof window !== "undefined") {
|
|
return `${window.location.origin}/api/langgraph`;
|
|
}
|
|
// Fallback for SSR
|
|
return "http://localhost:2026/api/langgraph";
|
|
}
|
|
}
|