@mastra/playground-ui 5.1.9-alpha.0 → 5.1.10-alpha.0
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 +11 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +11 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -4834,6 +4834,12 @@ class PDFAttachmentAdapter {
|
|
|
4834
4834
|
const convertMessage$2 = (message) => {
|
|
4835
4835
|
return message;
|
|
4836
4836
|
};
|
|
4837
|
+
const handleFinishReason = (finishReason) => {
|
|
4838
|
+
switch (finishReason) {
|
|
4839
|
+
case "tool-calls":
|
|
4840
|
+
throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
|
|
4841
|
+
}
|
|
4842
|
+
};
|
|
4837
4843
|
const convertToAIAttachments = async (attachments) => {
|
|
4838
4844
|
const promises = attachments.filter((attachment) => attachment.type === "image" || attachment.type === "document").map(async (attachment) => {
|
|
4839
4845
|
if (attachment.type === "document") {
|
|
@@ -5022,6 +5028,7 @@ function MastraRuntimeProvider({
|
|
|
5022
5028
|
{ role: "assistant", content: [] }
|
|
5023
5029
|
);
|
|
5024
5030
|
setMessages((currentConversation) => [...currentConversation, latestMessage]);
|
|
5031
|
+
handleFinishReason(generateResponse.finishReason);
|
|
5025
5032
|
}
|
|
5026
5033
|
} else {
|
|
5027
5034
|
let updater = function() {
|
|
@@ -5151,6 +5158,9 @@ function MastraRuntimeProvider({
|
|
|
5151
5158
|
},
|
|
5152
5159
|
onErrorPart(error) {
|
|
5153
5160
|
throw new Error(error);
|
|
5161
|
+
},
|
|
5162
|
+
onFinishMessagePart({ finishReason }) {
|
|
5163
|
+
handleFinishReason(finishReason);
|
|
5154
5164
|
}
|
|
5155
5165
|
});
|
|
5156
5166
|
}
|
|
@@ -5163,7 +5173,7 @@ function MastraRuntimeProvider({
|
|
|
5163
5173
|
setIsRunning(false);
|
|
5164
5174
|
setMessages((currentConversation) => [
|
|
5165
5175
|
...currentConversation,
|
|
5166
|
-
{ role: "assistant", content: [{ type: "text", text:
|
|
5176
|
+
{ role: "assistant", content: [{ type: "text", text: `${error}` }] }
|
|
5167
5177
|
]);
|
|
5168
5178
|
}
|
|
5169
5179
|
};
|