@mastra/playground-ui 5.0.3-alpha.0 → 5.0.3
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.cjs.js +27 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +27 -17
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -4035,13 +4035,16 @@ function MastraRuntimeProvider({
|
|
|
4035
4035
|
if (message?.toolInvocations?.length > 0) {
|
|
4036
4036
|
return {
|
|
4037
4037
|
...message,
|
|
4038
|
-
content:
|
|
4039
|
-
type: "
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4038
|
+
content: [
|
|
4039
|
+
...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
|
|
4040
|
+
...message.toolInvocations.map((toolInvocation) => ({
|
|
4041
|
+
type: "tool-call",
|
|
4042
|
+
toolCallId: toolInvocation?.toolCallId,
|
|
4043
|
+
toolName: toolInvocation?.toolName,
|
|
4044
|
+
args: toolInvocation?.args,
|
|
4045
|
+
result: toolInvocation?.result
|
|
4046
|
+
}))
|
|
4047
|
+
]
|
|
4045
4048
|
};
|
|
4046
4049
|
}
|
|
4047
4050
|
return message;
|
|
@@ -4156,6 +4159,13 @@ function MastraRuntimeProvider({
|
|
|
4156
4159
|
};
|
|
4157
4160
|
if (!assistantMessageAdded) {
|
|
4158
4161
|
assistantMessageAdded = true;
|
|
4162
|
+
if (assistantToolCallAddedForUpdater) {
|
|
4163
|
+
assistantToolCallAddedForUpdater = false;
|
|
4164
|
+
}
|
|
4165
|
+
return [...currentConversation, message2];
|
|
4166
|
+
}
|
|
4167
|
+
if (assistantToolCallAddedForUpdater) {
|
|
4168
|
+
assistantToolCallAddedForUpdater = false;
|
|
4159
4169
|
return [...currentConversation, message2];
|
|
4160
4170
|
}
|
|
4161
4171
|
return [...currentConversation.slice(0, -1), message2];
|
|
@@ -4183,22 +4193,18 @@ function MastraRuntimeProvider({
|
|
|
4183
4193
|
if (!response.body) {
|
|
4184
4194
|
throw new Error("No response body");
|
|
4185
4195
|
}
|
|
4186
|
-
const parts = [];
|
|
4187
4196
|
let content = "";
|
|
4188
|
-
let currentTextPart = null;
|
|
4189
4197
|
let assistantMessageAdded = false;
|
|
4198
|
+
let assistantToolCallAddedForUpdater = false;
|
|
4199
|
+
let assistantToolCallAddedForContent = false;
|
|
4190
4200
|
await response.processDataStream({
|
|
4191
4201
|
onTextPart(value) {
|
|
4192
|
-
if (
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
text: value
|
|
4196
|
-
};
|
|
4197
|
-
parts.push(currentTextPart);
|
|
4202
|
+
if (assistantToolCallAddedForContent) {
|
|
4203
|
+
assistantToolCallAddedForContent = false;
|
|
4204
|
+
content = value;
|
|
4198
4205
|
} else {
|
|
4199
|
-
|
|
4206
|
+
content += value;
|
|
4200
4207
|
}
|
|
4201
|
-
content += value;
|
|
4202
4208
|
updater();
|
|
4203
4209
|
},
|
|
4204
4210
|
async onToolCallPart(value) {
|
|
@@ -4225,6 +4231,8 @@ function MastraRuntimeProvider({
|
|
|
4225
4231
|
}
|
|
4226
4232
|
]
|
|
4227
4233
|
};
|
|
4234
|
+
assistantToolCallAddedForUpdater = true;
|
|
4235
|
+
assistantToolCallAddedForContent = true;
|
|
4228
4236
|
return [...currentConversation.slice(0, -1), updatedMessage];
|
|
4229
4237
|
}
|
|
4230
4238
|
const newMessage = {
|
|
@@ -4239,6 +4247,8 @@ function MastraRuntimeProvider({
|
|
|
4239
4247
|
}
|
|
4240
4248
|
]
|
|
4241
4249
|
};
|
|
4250
|
+
assistantToolCallAddedForUpdater = true;
|
|
4251
|
+
assistantToolCallAddedForContent = true;
|
|
4242
4252
|
return [...currentConversation, newMessage];
|
|
4243
4253
|
});
|
|
4244
4254
|
},
|