@xsai/stream-text 0.4.0-beta.7 → 0.4.0-beta.9
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/README.md +1 -0
- package/dist/index.js +8 -2
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
https://xsai.js.org/docs/packages/stream/text
|
package/dist/index.js
CHANGED
|
@@ -118,11 +118,17 @@ const streamText = (options) => {
|
|
|
118
118
|
for (const toolCall of choice.delta.tool_calls) {
|
|
119
119
|
const { index } = toolCall;
|
|
120
120
|
if (!tool_calls.at(index)) {
|
|
121
|
-
tool_calls[index] =
|
|
121
|
+
tool_calls[index] = {
|
|
122
|
+
...toolCall,
|
|
123
|
+
function: {
|
|
124
|
+
...toolCall.function,
|
|
125
|
+
arguments: toolCall.function.arguments
|
|
126
|
+
}
|
|
127
|
+
};
|
|
122
128
|
pushEvent({ toolCallId: toolCall.id, toolName: toolCall.function.name, type: "tool-call-streaming-start" });
|
|
123
129
|
} else {
|
|
124
130
|
tool_calls[index].function.arguments += toolCall.function.arguments;
|
|
125
|
-
pushEvent({ argsTextDelta: toolCall.function.arguments, toolCallId: toolCall.id, toolName: toolCall.function.name, type: "tool-call-delta" });
|
|
131
|
+
pushEvent({ argsTextDelta: toolCall.function.arguments, toolCallId: toolCall.id, toolName: toolCall.function.name ?? tool_calls[index].function.name, type: "tool-call-delta" });
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/stream-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.0-beta.
|
|
4
|
+
"version": "0.4.0-beta.9",
|
|
5
5
|
"description": "extra-small AI SDK.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xsai/shared": "~0.4.0-beta.
|
|
33
|
-
"@xsai/shared-chat": "~0.4.0-beta.
|
|
32
|
+
"@xsai/shared": "~0.4.0-beta.9",
|
|
33
|
+
"@xsai/shared-chat": "~0.4.0-beta.9"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"valibot": "^1.0.0",
|
|
37
|
-
"@xsai/tool": "~0.4.0-beta.
|
|
37
|
+
"@xsai/tool": "~0.4.0-beta.9"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "pkgroll",
|