import { Box, Card, Chip, Typography, LinearProgress, Stack, Table, TableBody, TableCell, TableHead, TableRow, Alert, CircularProgress, } from '@mui/material' import { useQuery } from '@tanstack/react-query' import { propertyService } from '../../services/propertyService' interface MetricCard { label: string value: string color: string note: string } const HEALTH_METRICS: MetricCard[] = [ { label: 'Extraktionsgenauigkeit', value: '94%', color: '#1a7a4a', note: 'Ø letzte 30 Tage' }, { label: 'Konfidenz-Ø', value: '73%', color: '#d97706', note: 'Alle Objekte' }, { label: 'Validierungsrate', value: '88%', color: '#1a7a4a', note: 'Menschliche Bestätigung' }, { label: 'Fehlerrate', value: '2.1%', color: '#1a7a4a', note: 'Kritische Fehler' }, ] interface AIDecision { timestamp: string type: string confidence: string result: string impact: string } const RECENT_DECISIONS: AIDecision[] = [ { timestamp: '15.05.2025 14:32', type: 'Bedarfsextraktion', confidence: '91%', result: 'Kriterien extrahiert', impact: 'Suche ausgelöst', }, { timestamp: '15.05.2025 11:15', type: 'Match-Scoring', confidence: '88%', result: '3 Matches berechnet', impact: 'Review ausgelöst', }, { timestamp: '14.05.2025 16:40', type: 'Signal-Erkennung', confidence: '72%', result: 'Expansion erkannt', impact: 'Signal erstellt', }, { timestamp: '14.05.2025 09:00', type: 'Datenqualitätsprüfung', confidence: '95%', result: '2 Warnungen erkannt', impact: 'Meldung erstellt', }, { timestamp: '13.05.2025 15:22', type: 'Match-Scoring', confidence: '84%', result: '2 Matches berechnet', impact: 'Review ausgelöst', }, { timestamp: '12.05.2025 10:11', type: 'Signal-Erkennung', confidence: '65%', result: 'Möglicher Auszug erkannt', impact: 'Signal erstellt', }, ] function getConfidenceBadge(pct: string) { const n = parseInt(pct) const color = n >= 85 ? '#1a7a4a' : n >= 70 ? '#d97706' : '#c0392b' return ( ) } export default function AIMonitoring() { const { data: propResp, isLoading } = useQuery({ queryKey: ['properties'], queryFn: () => propertyService.getAll(), }) const properties = propResp?.data ?? [] const highConf = properties.filter(p => p.confidenceScore > 0.85).length const midConf = properties.filter(p => p.confidenceScore >= 0.65 && p.confidenceScore <= 0.85).length const lowConf = properties.filter(p => p.confidenceScore < 0.65).length const total = properties.length || 1 return ( {/* Page Header */} AI Monitoring AI-Layer Gesundheit und Entscheidungsqualität {/* Health Metrics */} {HEALTH_METRICS.map(m => ( {m.label} {m.value} {m.note} ))} {/* Confidence Distribution */} Konfidenzverteilung {isLoading ? ( ) : ( Hoch (>85%) {highConf} Objekte Mittel (65–85%) {midConf} Objekte Niedrig (<65%) {lowConf} Objekte )} {/* Anomaly Alerts */} Anomalien Mietpreisangaben für prop-004 weichen von Marktdurchschnitt ab (±31%). Manuelle Prüfung empfohlen. Keine kritischen Anomalien erkannt. System läuft stabil. {/* Recent AI Decisions */} Letzte KI-Entscheidungen Zeitpunkt Entscheidungstyp Konfidenz Ergebnis Einfluss {RECENT_DECISIONS.map((d, i) => ( {d.timestamp} {d.type} {getConfidenceBadge(d.confidence)} {d.result} {d.impact} ))}
) }