import React, { useState, useEffect } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { Box, Typography, Card, CardContent, Button, Grid, Chip, Alert, CircularProgress, } from '@mui/material'; import { Chat as ChatIcon, ArrowBack as BackIcon, Storage as StorageIcon, Timeline as TimelineIcon, Diamond as DiamondIcon, Verified as VerifiedIcon, } from '@mui/icons-material'; import { getAgent } from '../api/client'; function AgentReady() { const { agentName } = useParams(); const navigate = useNavigate(); const [agent, setAgent] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { loadAgent(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [agentName]); const loadAgent = async () => { try { setLoading(true); const response = await getAgent(agentName); setAgent(response); } catch (err) { setError(err.response?.data?.detail || 'Failed to load agent'); } finally { setLoading(false); } }; if (loading) { return ( ); } if (error) { return ( {error} ); } const metadata = agent?.metadata || {}; const stats = agent?.stats || {}; const promptAnalysis = metadata?.prompt_analysis || {}; return ( {/* Header */} Agent Ready! 🎉 {agentName.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())} {/* Stats Grid */} {agent?.entity_count || agent?.chunk_count || 0} Vector Chunks {stats.source_files || 0} Processed Files Ready Status {/* Agent Details */} Agent Configuration PERSONALITY {promptAnalysis?.personality || 'Helpful and professional'} TONE {promptAnalysis?.tone || 'Professional'} CAPABILITIES {(promptAnalysis?.capabilities || ['Answer questions', 'Provide information']).map((cap, i) => ( ))} DOMAIN KEYWORDS {(metadata?.domain_signature || promptAnalysis?.domain_keywords || []) .slice(0, 15) .map((kw, i) => ( ))} {/* Additional Info */} 📊 Knowledge Base Summary Source Files {stats.source_files || 0} Total Entries {stats.total_entries || 0} Context Window {stats.context_length ? (stats.context_length / 1000).toFixed(1) + 'K' : 'N/A'} Est. Tokens {stats.context_tokens ? (stats.context_tokens / 1000).toFixed(1) + 'K' : 'N/A'} {/* Action Buttons */} ); } export default AgentReady;