mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-05 07:42:28 +08:00
The convertToModelMessages function from AI SDK can produce messages with empty content arrays when assistant messages have only tool call parts or when tool results aren't properly converted. Bedrock API rejects these with 400 errors. This fix filters out invalid messages before sending to the API.