import { Box, Button, Card, CardContent, Grid, LinearProgress, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography, styled } from '@mui/material'; const StyledCard = styled(Card)({ height: '100%', display: 'flex', flexDirection: 'column', boxShadow: '0 2px 8px rgba(0,0,0,0.1)', borderRadius: '8px', }); const CardTitle = styled(Typography)({ fontSize: '1rem', fontWeight: 'bold', marginBottom: '16px', }); const MetricsContainer = styled(Box)({ display: 'flex', justifyContent: 'space-between', marginBottom: '16px', }); const Metric = styled(Box)({ display: 'flex', flexDirection: 'column', }); const MetricValue = styled(Typography)({ fontSize: '1.5rem', fontWeight: 'bold', }); const MetricLabel = styled(Typography)({ fontSize: '0.75rem', color: '#666', }); const ProgressContainer = styled(Box)({ marginBottom: '16px', }); const ProgressLabel = styled(Box)({ display: 'flex', justifyContent: 'space-between', fontSize: '0.65rem', marginBottom: '4px', }); const StyledLinearProgress = styled(LinearProgress)({ height: '8px', borderRadius: '4px', }); const StatusPill = styled(Box)<{ status?: string }>(({ status }) => ({ display: 'inline-block', padding: '4px 8px', borderRadius: '12px', fontSize: '0.65rem', fontWeight: 'bold', backgroundColor: status === 'OK' ? '#e6f7ed' : '#ffebee', color: status === 'OK' ? '#00a389' : '#d32f2f', })); const InlineNote = styled('span')({ fontSize: '0.75rem', color: '#666', fontWeight: 'normal', marginLeft: '4px', }); // 模拟数据 const recentQueries = [ { query: 'How to reset device firmware?', latency: 732, source: 'manual.pdf', time: '09:21', status: 'OK' }, { query: 'List authentication failure codes', latency: 801, source: 'auth_guide.html', time: '09:18', status: 'OK' }, { query: 'Can we purge stale vectors?', latency: 915, source: 'system_kb', time: '09:10', status: 'OK' }, { query: 'Explain retrieval scoring logic', latency: 845, source: 'design_notes', time: '08:57', status: 'OK' }, { query: 'Pipeline concurrency limits?', latency: 1042, source: 'ops_doc', time: '08:43', status: 'OK' }, ]; const Home = () => { return ( {/* Knowledge Base Status Card */} Knowledge Base Status Documents 4,218 Sources 17 Vectors 1.2M Sync Progress 62% {/* Recent Activity Card */} Recent Activity (latest 24h) 152 user queries processed 87 new documents ingested 4 pipeline adjustments Latency stable at p95 820ms {/* Model Overview Card */} Model Overview Embedding Model: text-embedding-3-large Generator: gpt-4o-mini Reranker: cross-encoder-v2 Chunking: 512 tokens Retriever Top-K: 8 Healthy {/* Recent RAG Queries Table */} Recent RAG Queries (latest 5) Query Latency (ms) Source Time Status {recentQueries.map((row, index) => ( {row.query} {row.latency} {row.source} {row.time} {row.status} ))}
); }; export default Home;