{JSON.stringify(spec, null, 2)}
)
}
}
export function MessageBody({ content, isToolResult, toolCalls }: MessageBodyProps) {
const { prose, actionCount, cardBlocks } = useMemo(() => {
const blocks = extractActionBlocks(content)
const cleaned = stripToolCallTags(content)
.replace(ACTION_BLOCK_RE, "")
.trim()
const { blocks: cardBlocks, stripped } = parseCardBlocks(cleaned)
return {
prose: stripped.trim(),
actionCount: blocks.length,
cardBlocks,
}
}, [content])
if (isToolResult) {
return (
{content}
{children}
, code: ({ children, className }) => { const isBlock = className?.startsWith("language-") if (isBlock) { return (
{children}
)
}
return (
{children}
)
},
ul: ({ children }) =>