const { useState } = React; const { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer } = Recharts; function App() { const [data, setData] = useState(null); const [query, setQuery] = useState(''); const [insights, setInsights] = useState([]); const handleFileUpload = async (event) => { const file = event.target.files[0]; const formData = new FormData(); formData.append('file', file); const response = await fetch('/api/process-file', { method: 'POST', body: formData, }); const result = await response.json(); setData(result); }; const handleQuery = async () => { if (!data || !query) return; const response = await fetch('/api/query', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query, embeddings: data.embeddings }), }); const result = await response.json(); const newInsights = result.similar_indices.map(idx => data.raw_data[idx]); setInsights(newInsights); }; return (