@mastra/playground-ui 5.1.9 → 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 CHANGED
@@ -4867,6 +4867,12 @@ class PDFAttachmentAdapter {
4867
4867
  const convertMessage$2 = (message) => {
4868
4868
  return message;
4869
4869
  };
4870
+ const handleFinishReason = (finishReason) => {
4871
+ switch (finishReason) {
4872
+ case "tool-calls":
4873
+ throw new Error("Stream finished with reason tool-calls, try increasing maxSteps");
4874
+ }
4875
+ };
4870
4876
  const convertToAIAttachments = async (attachments) => {
4871
4877
  const promises = attachments.filter((attachment) => attachment.type === "image" || attachment.type === "document").map(async (attachment) => {
4872
4878
  if (attachment.type === "document") {
@@ -5055,6 +5061,7 @@ function MastraRuntimeProvider({
5055
5061
  { role: "assistant", content: [] }
5056
5062
  );
5057
5063
  setMessages((currentConversation) => [...currentConversation, latestMessage]);
5064
+ handleFinishReason(generateResponse.finishReason);
5058
5065
  }
5059
5066
  } else {
5060
5067
  let updater = function() {
@@ -5184,6 +5191,9 @@ function MastraRuntimeProvider({
5184
5191
  },
5185
5192
  onErrorPart(error) {
5186
5193
  throw new Error(error);
5194
+ },
5195
+ onFinishMessagePart({ finishReason }) {
5196
+ handleFinishReason(finishReason);
5187
5197
  }
5188
5198
  });
5189
5199
  }
@@ -5196,7 +5206,7 @@ function MastraRuntimeProvider({
5196
5206
  setIsRunning(false);
5197
5207
  setMessages((currentConversation) => [
5198
5208
  ...currentConversation,
5199
- { role: "assistant", content: [{ type: "text", text: `Error: ${error}` }] }
5209
+ { role: "assistant", content: [{ type: "text", text: `${error}` }] }
5200
5210
  ]);
5201
5211
  }
5202
5212
  };