{message.experimental_attachments && (
{message.experimental_attachments.map((attachment) => (
))}
)}
{message.parts?.map((part, index) => {
const { type } = part;
const key = `message-${message.id}-part-${index}`;
if (type === 'reasoning') {
return (
);
}
if (type === 'text') {
if (mode === 'view') {
return (
{message.role === 'user' && !isReadonly && (
Edit message
)}
{part.text}
);
}
if (mode === 'edit') {
return (
);
}
}
if (type === 'tool-invocation') {
const { toolInvocation } = part;
const { toolName, toolCallId, state } = toolInvocation;
if (state === 'call') {
const { args } = toolInvocation;
return (
{toolName === 'getWeather' ? (
) : toolName === 'createDocument' ? (
) : toolName === 'updateDocument' ? (
) : toolName === 'requestSuggestions' ? (
) : null}
);
}
if (state === 'result') {
const { result } = toolInvocation;
return (
{toolName === 'getWeather' ? (
) : toolName === 'createDocument' ? (
) : toolName === 'updateDocument' ? (
) : toolName === 'requestSuggestions' ? (
) : (
{JSON.stringify(result, null, 2)}
)}
);
}
}
})}
{!isReadonly && (
)}