@mastra/playground-ui 5.1.2-alpha.6 → 5.1.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.es.js CHANGED
@@ -4615,22 +4615,26 @@ function MastraRuntimeProvider({
4615
4615
  if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
4616
4616
  if (initialMessages && threadId && memory) {
4617
4617
  const convertedMessages = initialMessages?.map((message) => {
4618
- if (message?.toolInvocations?.length > 0) {
4619
- return {
4620
- ...message,
4621
- content: [
4622
- ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
4623
- ...message.toolInvocations.map((toolInvocation) => ({
4624
- type: "tool-call",
4625
- toolCallId: toolInvocation?.toolCallId,
4626
- toolName: toolInvocation?.toolName,
4627
- args: toolInvocation?.args,
4628
- result: toolInvocation?.result
4629
- }))
4630
- ]
4631
- };
4632
- }
4633
- return message;
4618
+ const toolInvocationsAsContentParts = (message.toolInvocations || []).map((toolInvocation) => ({
4619
+ type: "tool-call",
4620
+ toolCallId: toolInvocation?.toolCallId,
4621
+ toolName: toolInvocation?.toolName,
4622
+ args: toolInvocation?.args,
4623
+ result: toolInvocation?.result
4624
+ }));
4625
+ const attachmentsAsContentParts = (message.experimental_attachments || []).map((image) => ({
4626
+ type: image.contentType.startsWith(`image/`) ? "image" : image.contentType.startsWith(`audio/`) ? "audio" : "file",
4627
+ mimeType: image.contentType,
4628
+ image: image.url
4629
+ }));
4630
+ return {
4631
+ ...message,
4632
+ content: [
4633
+ ...typeof message.content === "string" ? [{ type: "text", text: message.content }] : [],
4634
+ ...toolInvocationsAsContentParts,
4635
+ ...attachmentsAsContentParts
4636
+ ]
4637
+ };
4634
4638
  }).filter(Boolean);
4635
4639
  setMessages(convertedMessages);
4636
4640
  setCurrentThreadId(threadId);