/** * ToolResultBlock — 工具结果块 */ import { Box, Typography, Stack } from '@mui/material'; import { FileText } from 'lucide-react'; import type { ToolCallInfo } from '@renderer/stores/agent-store'; import { formatDuration } from '@renderer/lib/formatters'; interface ToolResultBlockProps { toolCall: ToolCallInfo; } export function ToolResultBlock({ toolCall }: ToolResultBlockProps): React.JSX.Element { if (toolCall.status !== 'success' || toolCall.result == null) return <>; const resultStr = typeof toolCall.result === 'string' ? toolCall.result : JSON.stringify(toolCall.result, null, 2); return ( {toolCall.name} 结果 {toolCall.durationMs != null && {formatDuration(toolCall.durationMs)}} {resultStr} ); }