mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-03 06:12:14 +08:00
fix(frontend): separate mock and default LangGraph clients (#1504)
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -30,8 +30,15 @@ function createCompatibleClient(isMock?: boolean): LangGraphClient {
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
let _singleton: LangGraphClient | null = null;
|
const _clients = new Map<string, LangGraphClient>();
|
||||||
export function getAPIClient(isMock?: boolean): LangGraphClient {
|
export function getAPIClient(isMock?: boolean): LangGraphClient {
|
||||||
_singleton ??= createCompatibleClient(isMock);
|
const cacheKey = isMock ? "mock" : "default";
|
||||||
return _singleton;
|
let client = _clients.get(cacheKey);
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
client = createCompatibleClient(isMock);
|
||||||
|
_clients.set(cacheKey, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user