import { Card, Timeline, Tag, Descriptions } from 'antd'; import { CheckCircleOutlined, LoadingOutlined, ExclamationCircleOutlined, CloseCircleOutlined } from '@ant-design/icons'; interface DebugEvent { timestamp: string; type: 'policy_check' | 'ocr' | 'ai_analysis' | 'upload' | 'error'; status: 'pending' | 'success' | 'warning' | 'error'; message: string; data?: any; } interface Props { events: DebugEvent[]; formData: any; } export default function DebugPanel({ events, formData }: Props) { const getIcon = (status: string) => { switch (status) { case 'success': return ; case 'pending': return ; case 'warning': return ; case 'error': return ; default: return ; } }; const getColor = (status: string) => { switch (status) { case 'success': return 'success'; case 'pending': return 'processing'; case 'warning': return 'warning'; case 'error': return 'error'; default: return 'default'; } }; return (
{/* Текущие данные формы */}
Form Data:
            {JSON.stringify(formData, null, 2)}
          
{/* События */}
Events Log:
Нет событий... } ] : events.map((event, index) => ({ key: index, dot: getIcon(event.status), children: (
{event.timestamp}
{event.type.toUpperCase()} {event.message}
{event.data && (
{event.type === 'policy_check' && event.data.found !== undefined && ( Found} labelStyle={{ background: '#252526', color: '#9cdcfe' }} contentStyle={{ background: '#1e1e1e', color: event.data.found ? '#4ec9b0' : '#f48771' }} > {event.data.found ? 'TRUE' : 'FALSE'} {event.data.holder_name && ( Holder} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#ce9178' }} > {event.data.holder_name} )} )} {event.type === 'ocr' && (
                        {event.data.text?.substring(0, 300)}...
                      
)} {event.type === 'ai_analysis' && ( Type} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#4ec9b0' }} > {event.data.document_type} Valid} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: event.data.is_valid ? '#4ec9b0' : '#f48771' }} > {event.data.is_valid ? 'TRUE' : 'FALSE'} Confidence} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#dcdcaa' }} > {(event.data.confidence * 100).toFixed(0)}% {event.data.extracted_data && Object.keys(event.data.extracted_data).length > 0 && ( Extracted} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e' }} >
                              {JSON.stringify(event.data.extracted_data, null, 2)}
                            
)}
)} {event.type === 'upload' && event.data.files && (
{event.data.files.map((file: any, idx: number) => ( File} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#ce9178', fontSize: 10 }} > {file.filename} File ID} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#569cd6', fontSize: 9, fontFamily: 'monospace' }} > {file.file_id} Size} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', color: '#dcdcaa' }} > {(file.size / 1024).toFixed(1)} KB {file.url && ( S3 URL} labelStyle={{ background: '#252526' }} contentStyle={{ background: '#1e1e1e', fontSize: 9, wordBreak: 'break-all' }} > {file.url} )} ))}
)}
)}
) }))} /> {events.length > 0 && (
Total events: {events.length}
)}
); }