@langgraph-js/sdk 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/LangGraphClient.js
CHANGED
|
@@ -140,6 +140,9 @@ export class LangGraphClient extends EventEmitter {
|
|
|
140
140
|
messages: this.messageProcessor.getGraphMessages(),
|
|
141
141
|
},
|
|
142
142
|
});
|
|
143
|
+
if (this.currentThread?.status === "interrupted") {
|
|
144
|
+
this.sendMessage([], { joinRunId: this.currentThread.thread_id });
|
|
145
|
+
}
|
|
143
146
|
return this.currentThread;
|
|
144
147
|
}
|
|
145
148
|
// 从历史中恢复时,应该恢复流式状态
|
|
@@ -246,7 +246,7 @@ export const createChatStore = (initClientName, config, context = {}) => {
|
|
|
246
246
|
refreshGraph();
|
|
247
247
|
refreshTools();
|
|
248
248
|
const currentThread = activeClient.getCurrentThread();
|
|
249
|
-
if (currentThread && (currentThread.status === "
|
|
249
|
+
if (currentThread && (currentThread.status === "busy" || currentThread.status === "pending")) {
|
|
250
250
|
await activeClient.resetStream();
|
|
251
251
|
}
|
|
252
252
|
// 检查是否处于中断状态
|
package/package.json
CHANGED
package/src/LangGraphClient.ts
CHANGED
|
@@ -236,8 +236,10 @@ export class LangGraphClient<TStateType = unknown> extends EventEmitter<LangGrap
|
|
|
236
236
|
*/
|
|
237
237
|
async resetThread(agent: string, threadId: string) {
|
|
238
238
|
await this.initAssistant(agent);
|
|
239
|
+
|
|
239
240
|
this.currentThread = await this.threads.get(threadId);
|
|
240
241
|
this.graphState = (this.currentThread as any).values;
|
|
242
|
+
|
|
241
243
|
const graphMessages = this.graphState?.messages || [];
|
|
242
244
|
this.messageProcessor.setGraphMessages(graphMessages);
|
|
243
245
|
this.emit("value", {
|
|
@@ -246,6 +248,10 @@ export class LangGraphClient<TStateType = unknown> extends EventEmitter<LangGrap
|
|
|
246
248
|
messages: this.messageProcessor.getGraphMessages(),
|
|
247
249
|
},
|
|
248
250
|
});
|
|
251
|
+
if (this.currentThread?.status === "interrupted") {
|
|
252
|
+
this.sendMessage([], { joinRunId: this.currentThread.thread_id });
|
|
253
|
+
}
|
|
254
|
+
|
|
249
255
|
return this.currentThread;
|
|
250
256
|
}
|
|
251
257
|
// 从历史中恢复时,应该恢复流式状态
|
|
@@ -301,7 +301,7 @@ export const createChatStore = (initClientName: string, config: Partial<LangGrap
|
|
|
301
301
|
refreshTools();
|
|
302
302
|
|
|
303
303
|
const currentThread = activeClient.getCurrentThread() as any;
|
|
304
|
-
if (currentThread && (currentThread.status === "
|
|
304
|
+
if (currentThread && (currentThread.status === "busy" || currentThread.status === "pending")) {
|
|
305
305
|
await activeClient.resetStream();
|
|
306
306
|
}
|
|
307
307
|
|