ai 5.0.12 → 5.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 +11 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -7686,10 +7686,19 @@ function extractReasoningMiddleware({
|
|
7686
7686
|
wrapStream: async ({ doStream }) => {
|
7687
7687
|
const { stream, ...rest } = await doStream();
|
7688
7688
|
const reasoningExtractions = {};
|
7689
|
+
let delayedTextStart;
|
7689
7690
|
return {
|
7690
7691
|
stream: stream.pipeThrough(
|
7691
7692
|
new TransformStream({
|
7692
7693
|
transform: (chunk, controller) => {
|
7694
|
+
if (chunk.type === "text-start") {
|
7695
|
+
delayedTextStart = chunk;
|
7696
|
+
return;
|
7697
|
+
}
|
7698
|
+
if (chunk.type === "text-end" && delayedTextStart) {
|
7699
|
+
controller.enqueue(delayedTextStart);
|
7700
|
+
delayedTextStart = void 0;
|
7701
|
+
}
|
7693
7702
|
if (chunk.type !== "text-delta") {
|
7694
7703
|
controller.enqueue(chunk);
|
7695
7704
|
return;
|
@@ -7716,17 +7725,23 @@ function extractReasoningMiddleware({
|
|
7716
7725
|
id: `reasoning-${activeExtraction.idCounter}`
|
7717
7726
|
});
|
7718
7727
|
}
|
7719
|
-
|
7720
|
-
|
7728
|
+
if (activeExtraction.isReasoning) {
|
7729
|
+
controller.enqueue({
|
7721
7730
|
type: "reasoning-delta",
|
7722
7731
|
delta: prefix + text2,
|
7723
7732
|
id: `reasoning-${activeExtraction.idCounter}`
|
7724
|
-
}
|
7733
|
+
});
|
7734
|
+
} else {
|
7735
|
+
if (delayedTextStart) {
|
7736
|
+
controller.enqueue(delayedTextStart);
|
7737
|
+
delayedTextStart = void 0;
|
7738
|
+
}
|
7739
|
+
controller.enqueue({
|
7725
7740
|
type: "text-delta",
|
7726
7741
|
delta: prefix + text2,
|
7727
7742
|
id: activeExtraction.textId
|
7728
|
-
}
|
7729
|
-
|
7743
|
+
});
|
7744
|
+
}
|
7730
7745
|
activeExtraction.afterSwitch = false;
|
7731
7746
|
if (activeExtraction.isReasoning) {
|
7732
7747
|
activeExtraction.isFirstReasoning = false;
|