mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-01 04:39:01 +02:00
feat(react): support interrupt_before/after
This commit is contained in:
@@ -896,7 +896,12 @@ export function useStream<
|
||||
if (isLoading) return undefined;
|
||||
|
||||
const interrupts = threadHead?.tasks?.at(-1)?.interrupts;
|
||||
if (interrupts == null || interrupts.length === 0) return undefined;
|
||||
if (interrupts == null || interrupts.length === 0) {
|
||||
// check if there's a next task present
|
||||
const next = threadHead?.next ?? [];
|
||||
if (!next.length || error != null) return undefined;
|
||||
return { when: "breakpoint" };
|
||||
}
|
||||
|
||||
// Return only the current interrupt
|
||||
return interrupts.at(-1) as Interrupt<InterruptType> | undefined;
|
||||
|
||||
@@ -142,9 +142,9 @@ export interface AssistantGraph {
|
||||
* An interrupt thrown inside a thread.
|
||||
*/
|
||||
export interface Interrupt<TValue = unknown> {
|
||||
value: TValue;
|
||||
when: "during";
|
||||
resumable: boolean;
|
||||
value?: TValue;
|
||||
when: "during" | (string & {});
|
||||
resumable?: boolean;
|
||||
ns?: string[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user