@langchain/langgraph-sdk 0.0.61 → 0.0.62
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/react/stream.cjs +20 -20
- package/dist/react/stream.js +20 -20
- package/package.json +1 -1
package/dist/react/stream.cjs
CHANGED
|
@@ -320,6 +320,26 @@ function useStream(options) {
|
|
|
320
320
|
setStreamError(undefined);
|
|
321
321
|
submittingRef.current = true;
|
|
322
322
|
abortRef.current = new AbortController();
|
|
323
|
+
// Unbranch things
|
|
324
|
+
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
325
|
+
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
|
326
|
+
: undefined;
|
|
327
|
+
if (newPath != null)
|
|
328
|
+
setBranch(newPath ?? "");
|
|
329
|
+
// Assumption: we're setting the initial value
|
|
330
|
+
// Used for instant feedback
|
|
331
|
+
setStreamValues(() => {
|
|
332
|
+
const values = { ...historyValues };
|
|
333
|
+
if (submitOptions?.optimisticValues != null) {
|
|
334
|
+
return {
|
|
335
|
+
...values,
|
|
336
|
+
...(typeof submitOptions.optimisticValues === "function"
|
|
337
|
+
? submitOptions.optimisticValues(values)
|
|
338
|
+
: submitOptions.optimisticValues),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
return values;
|
|
342
|
+
});
|
|
323
343
|
let usableThreadId = threadId;
|
|
324
344
|
if (!usableThreadId) {
|
|
325
345
|
const thread = await client.threads.create();
|
|
@@ -349,26 +369,6 @@ function useStream(options) {
|
|
|
349
369
|
checkpoint,
|
|
350
370
|
streamMode,
|
|
351
371
|
});
|
|
352
|
-
// Unbranch things
|
|
353
|
-
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
354
|
-
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
|
355
|
-
: undefined;
|
|
356
|
-
if (newPath != null)
|
|
357
|
-
setBranch(newPath ?? "");
|
|
358
|
-
// Assumption: we're setting the initial value
|
|
359
|
-
// Used for instant feedback
|
|
360
|
-
setStreamValues(() => {
|
|
361
|
-
const values = { ...historyValues };
|
|
362
|
-
if (submitOptions?.optimisticValues != null) {
|
|
363
|
-
return {
|
|
364
|
-
...values,
|
|
365
|
-
...(typeof submitOptions.optimisticValues === "function"
|
|
366
|
-
? submitOptions.optimisticValues(values)
|
|
367
|
-
: submitOptions.optimisticValues),
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
return values;
|
|
371
|
-
});
|
|
372
372
|
let streamError;
|
|
373
373
|
for await (const { event, data } of run) {
|
|
374
374
|
if (event === "error") {
|
package/dist/react/stream.js
CHANGED
|
@@ -317,6 +317,26 @@ export function useStream(options) {
|
|
|
317
317
|
setStreamError(undefined);
|
|
318
318
|
submittingRef.current = true;
|
|
319
319
|
abortRef.current = new AbortController();
|
|
320
|
+
// Unbranch things
|
|
321
|
+
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
322
|
+
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
|
323
|
+
: undefined;
|
|
324
|
+
if (newPath != null)
|
|
325
|
+
setBranch(newPath ?? "");
|
|
326
|
+
// Assumption: we're setting the initial value
|
|
327
|
+
// Used for instant feedback
|
|
328
|
+
setStreamValues(() => {
|
|
329
|
+
const values = { ...historyValues };
|
|
330
|
+
if (submitOptions?.optimisticValues != null) {
|
|
331
|
+
return {
|
|
332
|
+
...values,
|
|
333
|
+
...(typeof submitOptions.optimisticValues === "function"
|
|
334
|
+
? submitOptions.optimisticValues(values)
|
|
335
|
+
: submitOptions.optimisticValues),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return values;
|
|
339
|
+
});
|
|
320
340
|
let usableThreadId = threadId;
|
|
321
341
|
if (!usableThreadId) {
|
|
322
342
|
const thread = await client.threads.create();
|
|
@@ -346,26 +366,6 @@ export function useStream(options) {
|
|
|
346
366
|
checkpoint,
|
|
347
367
|
streamMode,
|
|
348
368
|
});
|
|
349
|
-
// Unbranch things
|
|
350
|
-
const newPath = submitOptions?.checkpoint?.checkpoint_id
|
|
351
|
-
? branchByCheckpoint[submitOptions?.checkpoint?.checkpoint_id]?.branch
|
|
352
|
-
: undefined;
|
|
353
|
-
if (newPath != null)
|
|
354
|
-
setBranch(newPath ?? "");
|
|
355
|
-
// Assumption: we're setting the initial value
|
|
356
|
-
// Used for instant feedback
|
|
357
|
-
setStreamValues(() => {
|
|
358
|
-
const values = { ...historyValues };
|
|
359
|
-
if (submitOptions?.optimisticValues != null) {
|
|
360
|
-
return {
|
|
361
|
-
...values,
|
|
362
|
-
...(typeof submitOptions.optimisticValues === "function"
|
|
363
|
-
? submitOptions.optimisticValues(values)
|
|
364
|
-
: submitOptions.optimisticValues),
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
return values;
|
|
368
|
-
});
|
|
369
369
|
let streamError;
|
|
370
370
|
for await (const { event, data } of run) {
|
|
371
371
|
if (event === "error") {
|