import { useState } from 'react' import { CheckCircle, ChevronDown } from 'lucide-react' import { type ToolResultMessage } from '../../types' interface ToolResultMessageProps { message: ToolResultMessage } const ToolResultMessage: React.FC = ({ message }) => { const [expanded, setExpanded] = useState(false) const json = JSON.stringify(message.toolResult) const resultPreview = json.substring(0, 48) const shouldTruncate = json.length > 48 return (
Tool Result {message.toolName} {!shouldTruncate && (
{resultPreview}
)}
{shouldTruncate && (
setExpanded(!expanded)} > {expanded ? (
                {JSON.stringify(message.toolResult, null, 2)}
              
) : (
{resultPreview}
)}
)}
) } export default ToolResultMessage