mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
fix(@mastra/core): ensure messages are all core messages when using memory (#3267)
Builds on https://github.com/mastra-ai/mastra/pull/3230 In that PR I converted all messages to UI messages and that seems to somehow be a lossy operation. Here I'm taking the opposite approach. Any messages stored in memory are core messages, but messages sent via useChat will be ui messages. Because the AI sdk tries to convert all messages to core messages if some are UI messages (https://github.com/vercel/ai/blob/main/packages/ai/core/prompt/detect-prompt-type.ts#L14) this is a problem because it errors trying to convert core messages into core messages since they didn't expect that would happen. I added a test that catches the issue by storing messages in memory, then retrieving them, adding them to useChat, and then sending more messages via useChat. Should be good now! Fixes https://discord.com/channels/1309558646228779139/1350882749094952980/1353896035667284040
This commit is contained in:
parent
a8bd4cfce8
commit
7a3eeb02fe
8 changed files with 377 additions and 191 deletions
343
pnpm-lock.yaml
generated
343
pnpm-lock.yaml
generated
Loading…
Add table
Add a link
Reference in a new issue