mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-02 22:02:13 +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;
|
||||
}
|
||||
|
||||
let _singleton: LangGraphClient | null = null;
|
||||
const _clients = new Map<string, LangGraphClient>();
|
||||
export function getAPIClient(isMock?: boolean): LangGraphClient {
|
||||
_singleton ??= createCompatibleClient(isMock);
|
||||
return _singleton;
|
||||
const cacheKey = isMock ? "mock" : "default";
|
||||
let client = _clients.get(cacheKey);
|
||||
|
||||
if (!client) {
|
||||
client = createCompatibleClient(isMock);
|
||||
_clients.set(cacheKey, client);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user