{messages.map((m) => (
{m.role}:
{m.parts.map((part, i) => {
switch (part.type) {
case 'text':
return {part.text}
case 'tool-weather':
return
case 'reasoning':
return
default:
return null
}
})}
))}
)
}
```
Three things make this work. First, `useChat