diff --git a/frontend/src/core/api/api-client.ts b/frontend/src/core/api/api-client.ts index 0672d10..8e50472 100644 --- a/frontend/src/core/api/api-client.ts +++ b/frontend/src/core/api/api-client.ts @@ -2,12 +2,12 @@ import { Client as LangGraphClient } from "@langchain/langgraph-sdk/client"; -import { getBackendBaseURL } from "../config"; +import { getLangGraphBaseURL } from "../config"; let _singleton: LangGraphClient | null = null; export function getAPIClient(): LangGraphClient { _singleton ??= new LangGraphClient({ - apiUrl: getBackendBaseURL(), + apiUrl: getLangGraphBaseURL(), }); return _singleton; } diff --git a/frontend/src/core/config/index.ts b/frontend/src/core/config/index.ts index 49ea851..c2cf885 100644 --- a/frontend/src/core/config/index.ts +++ b/frontend/src/core/config/index.ts @@ -7,3 +7,11 @@ export function getBackendBaseURL() { return "http://localhost:8000"; } } + +export function getLangGraphBaseURL() { + if (env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) { + return env.NEXT_PUBLIC_LANGGRAPH_BASE_URL; + } else { + return getBackendBaseURL(); + } +} diff --git a/frontend/src/env.js b/frontend/src/env.js index c32228b..80d9165 100644 --- a/frontend/src/env.js +++ b/frontend/src/env.js @@ -25,6 +25,7 @@ export const env = createEnv({ */ client: { NEXT_PUBLIC_BACKEND_BASE_URL: z.string().optional(), + NEXT_PUBLIC_LANGGRAPH_BASE_URL: z.string().optional(), }, /** @@ -39,6 +40,7 @@ export const env = createEnv({ NODE_ENV: process.env.NODE_ENV, NEXT_PUBLIC_BACKEND_BASE_URL: process.env.NEXT_PUBLIC_BACKEND_BASE_URL, + NEXT_PUBLIC_LANGGRAPH_BASE_URL: process.env.NEXT_PUBLIC_LANGGRAPH_BASE_URL, }, /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially