ai 6.0.12 → 6.0.13
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 +6 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -898,7 +898,7 @@ import {
|
|
|
898
898
|
} from "@ai-sdk/provider-utils";
|
|
899
899
|
|
|
900
900
|
// src/version.ts
|
|
901
|
-
var VERSION = true ? "6.0.
|
|
901
|
+
var VERSION = true ? "6.0.13" : "0.0.0-test";
|
|
902
902
|
|
|
903
903
|
// src/util/download/download.ts
|
|
904
904
|
var download = async ({ url }) => {
|
|
@@ -10152,25 +10152,29 @@ function smoothStream({
|
|
|
10152
10152
|
return () => {
|
|
10153
10153
|
let buffer = "";
|
|
10154
10154
|
let id = "";
|
|
10155
|
+
let type = void 0;
|
|
10156
|
+
function flushBuffer(controller) {
|
|
10157
|
+
if (buffer.length > 0 && type !== void 0) {
|
|
10158
|
+
controller.enqueue({ type, text: buffer, id });
|
|
10159
|
+
buffer = "";
|
|
10160
|
+
}
|
|
10161
|
+
}
|
|
10155
10162
|
return new TransformStream({
|
|
10156
10163
|
async transform(chunk, controller) {
|
|
10157
|
-
if (chunk.type !== "text-delta") {
|
|
10158
|
-
|
|
10159
|
-
controller.enqueue({ type: "text-delta", text: buffer, id });
|
|
10160
|
-
buffer = "";
|
|
10161
|
-
}
|
|
10164
|
+
if (chunk.type !== "text-delta" && chunk.type !== "reasoning-delta") {
|
|
10165
|
+
flushBuffer(controller);
|
|
10162
10166
|
controller.enqueue(chunk);
|
|
10163
10167
|
return;
|
|
10164
10168
|
}
|
|
10165
|
-
if (chunk.id !== id && buffer.length > 0) {
|
|
10166
|
-
controller
|
|
10167
|
-
buffer = "";
|
|
10169
|
+
if ((chunk.type !== type || chunk.id !== id) && buffer.length > 0) {
|
|
10170
|
+
flushBuffer(controller);
|
|
10168
10171
|
}
|
|
10169
10172
|
buffer += chunk.text;
|
|
10170
10173
|
id = chunk.id;
|
|
10174
|
+
type = chunk.type;
|
|
10171
10175
|
let match;
|
|
10172
10176
|
while ((match = detectChunk(buffer)) != null) {
|
|
10173
|
-
controller.enqueue({ type
|
|
10177
|
+
controller.enqueue({ type, text: match, id });
|
|
10174
10178
|
buffer = buffer.slice(match.length);
|
|
10175
10179
|
await delay2(delayInMs);
|
|
10176
10180
|
}
|