@xsai/stream-text 0.2.1 → 0.2.2
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/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -128,4 +128,4 @@ interface StreamTextToolCall extends ToolCall {
|
|
|
128
128
|
}
|
|
129
129
|
declare const streamText: (options: StreamTextOptions) => Promise<StreamTextResult>;
|
|
130
130
|
|
|
131
|
-
export { type StreamTextChunkResult, type StreamTextOptions, type StreamTextResult, type StreamTextStep, streamText };
|
|
131
|
+
export { type StreamTextChunkResult, type StreamTextEvent, type StreamTextOptions, type StreamTextResult, type StreamTextStep, streamText };
|
package/dist/index.js
CHANGED
|
@@ -113,9 +113,9 @@ const streamText = async (options) => {
|
|
|
113
113
|
options2.onChunk?.(chunk);
|
|
114
114
|
chunkCtrl.enqueue(chunk);
|
|
115
115
|
usage = chunk.usage;
|
|
116
|
+
if (chunk.choices == null || chunk.choices.length === 0)
|
|
117
|
+
return;
|
|
116
118
|
const choice = chunk.choices[0];
|
|
117
|
-
if (!choice)
|
|
118
|
-
throw new XSAIError("no choice found");
|
|
119
119
|
if (choice.delta.tool_calls) {
|
|
120
120
|
shouldOutputText = false;
|
|
121
121
|
}
|