ai 6.0.294 → 6.0.296
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/CHANGELOG.md +16 -0
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +46 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/docs/07-reference/01-ai-sdk-core/17-create-agent-ui-stream.mdx +3 -3
- package/docs/07-reference/01-ai-sdk-core/18-create-agent-ui-stream-response.mdx +2 -2
- package/docs/07-reference/01-ai-sdk-core/18-pipe-agent-ui-stream-to-response.mdx +3 -3
- package/package.json +2 -2
- package/src/agent/create-agent-ui-stream-response.ts +2 -2
- package/src/agent/create-agent-ui-stream.ts +5 -3
- package/src/agent/pipe-agent-ui-stream-to-response.ts +2 -2
- package/src/generate-text/smooth-stream.ts +24 -9
- package/src/ui/chat.ts +36 -7
- package/src/ui/process-ui-message-stream.ts +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.296
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0741da8: fix(ai): allow agent UI streams to use original messages as input
|
|
8
|
+
- a63fa9b: fix(ai): preserve tool metadata from tool output chunks
|
|
9
|
+
- a61bea9: Preserve provider metadata on corresponding `smoothStream` chunks without carrying it into subsequent metadata-free deltas.
|
|
10
|
+
|
|
11
|
+
## 6.0.295
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 0b38b6b: fix(ai): continue active UI message parts when resuming after a disconnect
|
|
16
|
+
- Updated dependencies [358683e]
|
|
17
|
+
- @ai-sdk/gateway@3.0.205
|
|
18
|
+
|
|
3
19
|
## 6.0.294
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -3564,7 +3564,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
|
|
|
3564
3564
|
* Runs the agent and returns a response object with a UI message stream.
|
|
3565
3565
|
*
|
|
3566
3566
|
* @param agent - The agent to run.
|
|
3567
|
-
* @param uiMessages - The input UI messages.
|
|
3567
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
3568
3568
|
* @param abortSignal - Abort signal. Optional.
|
|
3569
3569
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
3570
3570
|
* @param options - The options for the agent. Optional.
|
|
@@ -3579,7 +3579,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
|
|
|
3579
3579
|
*/
|
|
3580
3580
|
declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
|
|
3581
3581
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
3582
|
-
uiMessages
|
|
3582
|
+
uiMessages?: unknown[];
|
|
3583
3583
|
abortSignal?: AbortSignal;
|
|
3584
3584
|
timeout?: TimeoutConfiguration;
|
|
3585
3585
|
options?: CALL_OPTIONS;
|
|
@@ -3862,6 +3862,7 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
3862
3862
|
private pendingApprovalMessageId;
|
|
3863
3863
|
private activeResponse;
|
|
3864
3864
|
private activeResumeRequest;
|
|
3865
|
+
private resumableStreamState;
|
|
3865
3866
|
private jobExecutor;
|
|
3866
3867
|
constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
|
|
3867
3868
|
state: ChatState<UI_MESSAGE>;
|
|
@@ -4366,7 +4367,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
|
4366
4367
|
* Runs the agent and stream the output as a UI message stream.
|
|
4367
4368
|
*
|
|
4368
4369
|
* @param agent - The agent to run.
|
|
4369
|
-
* @param uiMessages - The input UI messages.
|
|
4370
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
4370
4371
|
* @param abortSignal - The abort signal. Optional.
|
|
4371
4372
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
4372
4373
|
* @param options - The options for the agent.
|
|
@@ -4377,7 +4378,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
|
4377
4378
|
*/
|
|
4378
4379
|
declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, timeout, experimental_transform, onStepFinish, ...uiMessageStreamOptions }: {
|
|
4379
4380
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
4380
|
-
uiMessages
|
|
4381
|
+
uiMessages?: unknown[];
|
|
4381
4382
|
abortSignal?: AbortSignal;
|
|
4382
4383
|
timeout?: TimeoutConfiguration;
|
|
4383
4384
|
options?: CALL_OPTIONS;
|
|
@@ -4390,7 +4391,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
|
|
|
4390
4391
|
*
|
|
4391
4392
|
* @param response - The Node.js ServerResponse object to pipe to.
|
|
4392
4393
|
* @param agent - The agent to run.
|
|
4393
|
-
* @param uiMessages - The input UI messages.
|
|
4394
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
4394
4395
|
* @param abortSignal - Abort signal. Optional.
|
|
4395
4396
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
4396
4397
|
* @param options - The options for the agent. Optional.
|
|
@@ -4404,7 +4405,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
|
|
|
4404
4405
|
declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
|
|
4405
4406
|
response: ServerResponse;
|
|
4406
4407
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
4407
|
-
uiMessages
|
|
4408
|
+
uiMessages?: unknown[];
|
|
4408
4409
|
abortSignal?: AbortSignal;
|
|
4409
4410
|
timeout?: TimeoutConfiguration;
|
|
4410
4411
|
options?: CALL_OPTIONS;
|
package/dist/index.d.ts
CHANGED
|
@@ -3564,7 +3564,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
|
|
|
3564
3564
|
* Runs the agent and returns a response object with a UI message stream.
|
|
3565
3565
|
*
|
|
3566
3566
|
* @param agent - The agent to run.
|
|
3567
|
-
* @param uiMessages - The input UI messages.
|
|
3567
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
3568
3568
|
* @param abortSignal - Abort signal. Optional.
|
|
3569
3569
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
3570
3570
|
* @param options - The options for the agent. Optional.
|
|
@@ -3579,7 +3579,7 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
|
|
|
3579
3579
|
*/
|
|
3580
3580
|
declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
|
|
3581
3581
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
3582
|
-
uiMessages
|
|
3582
|
+
uiMessages?: unknown[];
|
|
3583
3583
|
abortSignal?: AbortSignal;
|
|
3584
3584
|
timeout?: TimeoutConfiguration;
|
|
3585
3585
|
options?: CALL_OPTIONS;
|
|
@@ -3862,6 +3862,7 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
3862
3862
|
private pendingApprovalMessageId;
|
|
3863
3863
|
private activeResponse;
|
|
3864
3864
|
private activeResumeRequest;
|
|
3865
|
+
private resumableStreamState;
|
|
3865
3866
|
private jobExecutor;
|
|
3866
3867
|
constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
|
|
3867
3868
|
state: ChatState<UI_MESSAGE>;
|
|
@@ -4366,7 +4367,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
|
4366
4367
|
* Runs the agent and stream the output as a UI message stream.
|
|
4367
4368
|
*
|
|
4368
4369
|
* @param agent - The agent to run.
|
|
4369
|
-
* @param uiMessages - The input UI messages.
|
|
4370
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
4370
4371
|
* @param abortSignal - The abort signal. Optional.
|
|
4371
4372
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
4372
4373
|
* @param options - The options for the agent.
|
|
@@ -4377,7 +4378,7 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
|
|
|
4377
4378
|
*/
|
|
4378
4379
|
declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, timeout, experimental_transform, onStepFinish, ...uiMessageStreamOptions }: {
|
|
4379
4380
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
4380
|
-
uiMessages
|
|
4381
|
+
uiMessages?: unknown[];
|
|
4381
4382
|
abortSignal?: AbortSignal;
|
|
4382
4383
|
timeout?: TimeoutConfiguration;
|
|
4383
4384
|
options?: CALL_OPTIONS;
|
|
@@ -4390,7 +4391,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
|
|
|
4390
4391
|
*
|
|
4391
4392
|
* @param response - The Node.js ServerResponse object to pipe to.
|
|
4392
4393
|
* @param agent - The agent to run.
|
|
4393
|
-
* @param uiMessages - The input UI messages.
|
|
4394
|
+
* @param uiMessages - The input UI messages. Defaults to originalMessages.
|
|
4394
4395
|
* @param abortSignal - Abort signal. Optional.
|
|
4395
4396
|
* @param timeout - Timeout in milliseconds. Optional.
|
|
4396
4397
|
* @param options - The options for the agent. Optional.
|
|
@@ -4404,7 +4405,7 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
|
|
|
4404
4405
|
declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
|
|
4405
4406
|
response: ServerResponse;
|
|
4406
4407
|
agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
|
|
4407
|
-
uiMessages
|
|
4408
|
+
uiMessages?: unknown[];
|
|
4408
4409
|
abortSignal?: AbortSignal;
|
|
4409
4410
|
timeout?: TimeoutConfiguration;
|
|
4410
4411
|
options?: CALL_OPTIONS;
|
package/dist/index.js
CHANGED
|
@@ -1334,7 +1334,7 @@ function detectMediaType({
|
|
|
1334
1334
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1335
1335
|
|
|
1336
1336
|
// src/version.ts
|
|
1337
|
-
var VERSION = true ? "6.0.
|
|
1337
|
+
var VERSION = true ? "6.0.296" : "0.0.0-test";
|
|
1338
1338
|
|
|
1339
1339
|
// src/util/download/download.ts
|
|
1340
1340
|
var download = async ({
|
|
@@ -6023,7 +6023,7 @@ function processUIMessageStream({
|
|
|
6023
6023
|
new TransformStream({
|
|
6024
6024
|
async transform(chunk, controller) {
|
|
6025
6025
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
6026
|
-
var _a23, _b, _c, _d;
|
|
6026
|
+
var _a23, _b, _c, _d, _e, _f, _g, _h;
|
|
6027
6027
|
function getCurrentStepParts() {
|
|
6028
6028
|
const parts = state.message.parts;
|
|
6029
6029
|
let currentStepStartIndex = parts.length - 1;
|
|
@@ -6457,7 +6457,7 @@ function processUIMessageStream({
|
|
|
6457
6457
|
providerExecuted: chunk.providerExecuted,
|
|
6458
6458
|
providerMetadata: chunk.providerMetadata,
|
|
6459
6459
|
title: toolInvocation.title,
|
|
6460
|
-
toolMetadata: toolInvocation.toolMetadata
|
|
6460
|
+
toolMetadata: (_e = chunk.toolMetadata) != null ? _e : toolInvocation.toolMetadata
|
|
6461
6461
|
},
|
|
6462
6462
|
toolInvocation
|
|
6463
6463
|
);
|
|
@@ -6473,7 +6473,7 @@ function processUIMessageStream({
|
|
|
6473
6473
|
preliminary: chunk.preliminary,
|
|
6474
6474
|
providerMetadata: chunk.providerMetadata,
|
|
6475
6475
|
title: toolInvocation.title,
|
|
6476
|
-
toolMetadata: toolInvocation.toolMetadata
|
|
6476
|
+
toolMetadata: (_f = chunk.toolMetadata) != null ? _f : toolInvocation.toolMetadata
|
|
6477
6477
|
},
|
|
6478
6478
|
toolInvocation
|
|
6479
6479
|
);
|
|
@@ -6494,7 +6494,7 @@ function processUIMessageStream({
|
|
|
6494
6494
|
providerExecuted: chunk.providerExecuted,
|
|
6495
6495
|
providerMetadata: chunk.providerMetadata,
|
|
6496
6496
|
title: toolInvocation.title,
|
|
6497
|
-
toolMetadata: toolInvocation.toolMetadata
|
|
6497
|
+
toolMetadata: (_g = chunk.toolMetadata) != null ? _g : toolInvocation.toolMetadata
|
|
6498
6498
|
},
|
|
6499
6499
|
toolInvocation
|
|
6500
6500
|
);
|
|
@@ -6510,7 +6510,7 @@ function processUIMessageStream({
|
|
|
6510
6510
|
providerExecuted: chunk.providerExecuted,
|
|
6511
6511
|
providerMetadata: chunk.providerMetadata,
|
|
6512
6512
|
title: toolInvocation.title,
|
|
6513
|
-
toolMetadata: toolInvocation.toolMetadata
|
|
6513
|
+
toolMetadata: (_h = chunk.toolMetadata) != null ? _h : toolInvocation.toolMetadata
|
|
6514
6514
|
},
|
|
6515
6515
|
toolInvocation
|
|
6516
6516
|
);
|
|
@@ -10332,8 +10332,9 @@ async function createAgentUIStream({
|
|
|
10332
10332
|
...uiMessageStreamOptions
|
|
10333
10333
|
}) {
|
|
10334
10334
|
var _a23;
|
|
10335
|
+
const inputMessages = uiMessages != null ? uiMessages : uiMessageStreamOptions.originalMessages;
|
|
10335
10336
|
const validatedMessages = await validateUIMessagesForAgent({
|
|
10336
|
-
messages:
|
|
10337
|
+
messages: inputMessages,
|
|
10337
10338
|
tools: agent.tools
|
|
10338
10339
|
});
|
|
10339
10340
|
const modelMessages = await convertToModelMessages(validatedMessages, {
|
|
@@ -12737,21 +12738,32 @@ function smoothStream({
|
|
|
12737
12738
|
controller.enqueue(chunk);
|
|
12738
12739
|
return;
|
|
12739
12740
|
}
|
|
12740
|
-
if (
|
|
12741
|
+
if (chunk.text.length === 0 && chunk.providerMetadata != null) {
|
|
12742
|
+
flushBuffer(controller);
|
|
12743
|
+
controller.enqueue(chunk);
|
|
12744
|
+
return;
|
|
12745
|
+
}
|
|
12746
|
+
if (buffer.length > 0 && (chunk.type !== type || chunk.id !== id || providerMetadata != null || chunk.providerMetadata != null)) {
|
|
12741
12747
|
flushBuffer(controller);
|
|
12742
12748
|
}
|
|
12743
12749
|
buffer += chunk.text;
|
|
12744
12750
|
id = chunk.id;
|
|
12745
12751
|
type = chunk.type;
|
|
12746
|
-
|
|
12747
|
-
providerMetadata = chunk.providerMetadata;
|
|
12748
|
-
}
|
|
12752
|
+
providerMetadata = chunk.providerMetadata;
|
|
12749
12753
|
let match;
|
|
12750
12754
|
while ((match = detectChunk(buffer)) != null) {
|
|
12751
|
-
controller.enqueue({
|
|
12755
|
+
controller.enqueue({
|
|
12756
|
+
type,
|
|
12757
|
+
text: match,
|
|
12758
|
+
id,
|
|
12759
|
+
...providerMetadata != null ? { providerMetadata } : {}
|
|
12760
|
+
});
|
|
12752
12761
|
buffer = buffer.slice(match.length);
|
|
12753
12762
|
await delay(isDocumentHidden() ? null : delayInMs);
|
|
12754
12763
|
}
|
|
12764
|
+
if (buffer.length === 0) {
|
|
12765
|
+
providerMetadata = void 0;
|
|
12766
|
+
}
|
|
12755
12767
|
}
|
|
12756
12768
|
});
|
|
12757
12769
|
};
|
|
@@ -14450,6 +14462,7 @@ var AbstractChat = class {
|
|
|
14450
14462
|
}) {
|
|
14451
14463
|
this.activeResponse = void 0;
|
|
14452
14464
|
this.activeResumeRequest = void 0;
|
|
14465
|
+
this.resumableStreamState = void 0;
|
|
14453
14466
|
this.jobExecutor = new SerialJobExecutor();
|
|
14454
14467
|
/**
|
|
14455
14468
|
* Appends or replaces a user message to the chat list. This triggers the API call to fetch
|
|
@@ -14729,6 +14742,9 @@ var AbstractChat = class {
|
|
|
14729
14742
|
messageId
|
|
14730
14743
|
}) {
|
|
14731
14744
|
var _a23, _b, _c;
|
|
14745
|
+
if (trigger !== "resume-stream") {
|
|
14746
|
+
this.resumableStreamState = void 0;
|
|
14747
|
+
}
|
|
14732
14748
|
const abortController = new AbortController();
|
|
14733
14749
|
const activeResumeRequest = trigger === "resume-stream" ? { abortController } : void 0;
|
|
14734
14750
|
if (activeResumeRequest) {
|
|
@@ -14756,12 +14772,14 @@ var AbstractChat = class {
|
|
|
14756
14772
|
}));
|
|
14757
14773
|
if (isCurrentRequest()) {
|
|
14758
14774
|
this.setStatus({ status: "ready" });
|
|
14775
|
+
this.resumableStreamState = void 0;
|
|
14759
14776
|
}
|
|
14760
14777
|
clearActiveResumeRequest();
|
|
14761
14778
|
return;
|
|
14762
14779
|
}
|
|
14763
14780
|
if (reconnect == null) {
|
|
14764
14781
|
this.setStatus({ status: "ready" });
|
|
14782
|
+
this.resumableStreamState = void 0;
|
|
14765
14783
|
clearActiveResumeRequest();
|
|
14766
14784
|
return;
|
|
14767
14785
|
}
|
|
@@ -14770,6 +14788,7 @@ var AbstractChat = class {
|
|
|
14770
14788
|
if (abortController.signal.aborted || err.name === "AbortError") {
|
|
14771
14789
|
if (isCurrentRequest()) {
|
|
14772
14790
|
this.setStatus({ status: "ready" });
|
|
14791
|
+
this.resumableStreamState = void 0;
|
|
14773
14792
|
}
|
|
14774
14793
|
clearActiveResumeRequest();
|
|
14775
14794
|
return;
|
|
@@ -14796,7 +14815,7 @@ var AbstractChat = class {
|
|
|
14796
14815
|
let activeResponse;
|
|
14797
14816
|
try {
|
|
14798
14817
|
const response = {
|
|
14799
|
-
state: createStreamingUIMessageState({
|
|
14818
|
+
state: trigger === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : createStreamingUIMessageState({
|
|
14800
14819
|
lastMessage: trigger === "resume-stream" || trigger === "regenerate-message" ? void 0 : this.state.snapshot(responseMessage),
|
|
14801
14820
|
messageId: this.generateId()
|
|
14802
14821
|
}),
|
|
@@ -14875,17 +14894,26 @@ var AbstractChat = class {
|
|
|
14875
14894
|
if (isAbort) {
|
|
14876
14895
|
if (isCurrentRequest()) {
|
|
14877
14896
|
this.setStatus({ status: "ready" });
|
|
14897
|
+
if (this.resumableStreamState === response.state) {
|
|
14898
|
+
this.resumableStreamState = void 0;
|
|
14899
|
+
}
|
|
14878
14900
|
}
|
|
14879
14901
|
return null;
|
|
14880
14902
|
}
|
|
14881
14903
|
if (isCurrentRequest()) {
|
|
14882
14904
|
this.setStatus({ status: "ready" });
|
|
14905
|
+
if (this.resumableStreamState === response.state) {
|
|
14906
|
+
this.resumableStreamState = void 0;
|
|
14907
|
+
}
|
|
14883
14908
|
}
|
|
14884
14909
|
} catch (err) {
|
|
14885
14910
|
if (isAbort || err.name === "AbortError") {
|
|
14886
14911
|
isAbort = true;
|
|
14887
14912
|
if (isCurrentRequest()) {
|
|
14888
14913
|
this.setStatus({ status: "ready" });
|
|
14914
|
+
if (this.resumableStreamState === (activeResponse == null ? void 0 : activeResponse.state)) {
|
|
14915
|
+
this.resumableStreamState = void 0;
|
|
14916
|
+
}
|
|
14889
14917
|
}
|
|
14890
14918
|
return null;
|
|
14891
14919
|
}
|
|
@@ -14896,6 +14924,11 @@ var AbstractChat = class {
|
|
|
14896
14924
|
if (err instanceof TypeError && (err.message.toLowerCase().includes("fetch") || err.message.toLowerCase().includes("network"))) {
|
|
14897
14925
|
isDisconnect = true;
|
|
14898
14926
|
}
|
|
14927
|
+
if (isDisconnect) {
|
|
14928
|
+
this.resumableStreamState = activeResponse == null ? void 0 : activeResponse.state;
|
|
14929
|
+
} else if (this.resumableStreamState === (activeResponse == null ? void 0 : activeResponse.state)) {
|
|
14930
|
+
this.resumableStreamState = void 0;
|
|
14931
|
+
}
|
|
14899
14932
|
if (this.onError && err instanceof Error) {
|
|
14900
14933
|
this.onError(err);
|
|
14901
14934
|
}
|