mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-01 22:15:11 +02:00
fix: Allow configuring stream mode in useStream.joinStream()
This commit is contained in:
@@ -616,7 +616,7 @@ export interface UseStream<
|
||||
/**
|
||||
* Join an active stream.
|
||||
*/
|
||||
joinStream: (runId: string) => Promise<void>;
|
||||
joinStream: (runId: string, lastEventId?: string, options?: { streamMode?: StreamMode | StreamMode[] }) => Promise<void>;
|
||||
}
|
||||
|
||||
type ConfigWithConfigurable<ConfigurableType extends Record<string, unknown>> =
|
||||
@@ -951,13 +951,14 @@ export function useStream<
|
||||
}
|
||||
}
|
||||
|
||||
const joinStream = async (runId: string, lastEventId?: string) => {
|
||||
const joinStream = async (runId: string, lastEventId?: string, options?: { streamMode?: StreamMode | StreamMode[]; }) => {
|
||||
lastEventId ??= "-1";
|
||||
if (!threadId) return;
|
||||
await consumeStream(async (signal: AbortSignal) => {
|
||||
const stream = client.runs.joinStream(threadId, runId, {
|
||||
signal,
|
||||
lastEventId,
|
||||
streamMode: options?.streamMode,
|
||||
}) as AsyncGenerator<EventStreamEvent>;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user