({ metadata, showDetails, compact })
| 103 | showDetails?: boolean; |
| 104 | compact?: boolean; |
| 105 | }> = ({ metadata, showDetails, compact }) => { |
| 106 | const { tool_id, result, success, error } = metadata; |
| 107 | |
| 108 | return ( |
| 109 | <div |
| 110 | className={`${styles.toolResultMessage} ${compact ? styles.compact : ''} ${ |
| 111 | success ? styles.success : styles.error |
| 112 | }`} |
| 113 | > |
| 114 | <Space direction="vertical" style={{ width: '100%' }}> |
| 115 | <Space> |
| 116 | {success ? ( |
| 117 | <CheckCircleOutlined className={styles.successIcon} /> |
| 118 | ) : ( |
| 119 | <CloseCircleOutlined className={styles.errorIcon} /> |
| 120 | )} |
| 121 | <Text strong className={success ? styles.successText : styles.errorText}> |
| 122 | 📋 {success ? '工具执行成功' : '工具执行失败'} |
| 123 | </Text> |
| 124 | <Tag color={success ? 'green' : 'red'} style={{ fontSize: '10px' }}> |
| 125 | {tool_id} |
| 126 | </Tag> |
| 127 | </Space> |
| 128 | |
| 129 | {!success && error && ( |
| 130 | <Text type="danger" style={{ fontSize: '12px' }}> |
| 131 | 错误: {error} |
| 132 | </Text> |
| 133 | )} |
| 134 | |
| 135 | {showDetails && result && ( |
| 136 | <Collapse ghost size="small"> |
| 137 | <Panel |
| 138 | header={<Text type="secondary" style={{ fontSize: '12px' }}>结果详情</Text>} |
| 139 | key="result" |
| 140 | > |
| 141 | <pre className={styles.argsPanel}> |
| 142 | {typeof result === 'string' ? result : JSON.stringify(result, null, 2)} |
| 143 | </pre> |
| 144 | </Panel> |
| 145 | </Collapse> |
| 146 | )} |
| 147 | </Space> |
| 148 | </div> |
| 149 | ); |
| 150 | }; |
| 151 | |
| 152 | /** |
| 153 | * 最终响应消息组件 |
nothing calls this directly
no outgoing calls
no test coverage detected