ai 5.0.235 → 5.0.237
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 +17 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -727,7 +727,7 @@ import {
|
|
|
727
727
|
} from "@ai-sdk/provider-utils";
|
|
728
728
|
|
|
729
729
|
// src/version.ts
|
|
730
|
-
var VERSION = true ? "5.0.
|
|
730
|
+
var VERSION = true ? "5.0.237" : "0.0.0-test";
|
|
731
731
|
|
|
732
732
|
// src/util/download/download.ts
|
|
733
733
|
var download = async ({
|
|
@@ -3997,7 +3997,7 @@ function processUIMessageStream({
|
|
|
3997
3997
|
}
|
|
3998
3998
|
await updateMessageMetadata(chunk.messageMetadata);
|
|
3999
3999
|
if (chunk.messageId != null || chunk.messageMetadata != null) {
|
|
4000
|
-
write();
|
|
4000
|
+
write({ updateStatus: false });
|
|
4001
4001
|
}
|
|
4002
4002
|
break;
|
|
4003
4003
|
}
|
|
@@ -9654,12 +9654,14 @@ var AbstractChat = class {
|
|
|
9654
9654
|
}
|
|
9655
9655
|
return job({
|
|
9656
9656
|
state: response.state,
|
|
9657
|
-
write: () => {
|
|
9657
|
+
write: ({ updateStatus = true } = {}) => {
|
|
9658
9658
|
var _a17;
|
|
9659
9659
|
if (response.abortController.signal.aborted) {
|
|
9660
9660
|
return;
|
|
9661
9661
|
}
|
|
9662
|
-
|
|
9662
|
+
if (updateStatus) {
|
|
9663
|
+
this.setStatus({ status: "streaming" });
|
|
9664
|
+
}
|
|
9663
9665
|
const replaceLastMessage = response.state.message.id === ((_a17 = this.lastMessage) == null ? void 0 : _a17.id);
|
|
9664
9666
|
if (replaceLastMessage) {
|
|
9665
9667
|
this.state.replaceMessage(
|
|
@@ -9730,13 +9732,12 @@ var AbstractChat = class {
|
|
|
9730
9732
|
finishReason: activeResponse.state.finishReason
|
|
9731
9733
|
});
|
|
9732
9734
|
}
|
|
9733
|
-
}
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9735
|
+
} finally {
|
|
9736
|
+
if (this.activeResponse === activeResponse) {
|
|
9737
|
+
this.activeResponse = void 0;
|
|
9738
|
+
}
|
|
9739
|
+
clearActiveResumeRequest();
|
|
9738
9740
|
}
|
|
9739
|
-
clearActiveResumeRequest();
|
|
9740
9741
|
}
|
|
9741
9742
|
if (((_c = this.sendAutomaticallyWhen) == null ? void 0 : _c.call(this, { messages: this.state.messages })) && !isError) {
|
|
9742
9743
|
await this.makeRequest({
|
|
@@ -10228,6 +10229,27 @@ function createUIMessageStream({
|
|
|
10228
10229
|
}
|
|
10229
10230
|
|
|
10230
10231
|
// src/ui-message-stream/read-ui-message-stream.ts
|
|
10232
|
+
function createUIMessageSnapshot(message) {
|
|
10233
|
+
const textByPartIndex = /* @__PURE__ */ new Map();
|
|
10234
|
+
const messageWithoutText = {
|
|
10235
|
+
...message,
|
|
10236
|
+
parts: message.parts.map((part, index) => {
|
|
10237
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
10238
|
+
textByPartIndex.set(index, part.text);
|
|
10239
|
+
return { ...part, text: "" };
|
|
10240
|
+
}
|
|
10241
|
+
return part;
|
|
10242
|
+
})
|
|
10243
|
+
};
|
|
10244
|
+
const snapshot = structuredClone(messageWithoutText);
|
|
10245
|
+
for (const [index, text2] of textByPartIndex) {
|
|
10246
|
+
const part = snapshot.parts[index];
|
|
10247
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
10248
|
+
part.text = text2;
|
|
10249
|
+
}
|
|
10250
|
+
}
|
|
10251
|
+
return snapshot;
|
|
10252
|
+
}
|
|
10231
10253
|
function readUIMessageStream({
|
|
10232
10254
|
message,
|
|
10233
10255
|
stream,
|
|
@@ -10260,7 +10282,7 @@ function readUIMessageStream({
|
|
|
10260
10282
|
return job({
|
|
10261
10283
|
state,
|
|
10262
10284
|
write: () => {
|
|
10263
|
-
controller == null ? void 0 : controller.enqueue(
|
|
10285
|
+
controller == null ? void 0 : controller.enqueue(createUIMessageSnapshot(state.message));
|
|
10264
10286
|
}
|
|
10265
10287
|
});
|
|
10266
10288
|
},
|