import { useEffect, useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from './ui/Card'; import { Button } from './ui/Button'; import { Filter, Download } from 'lucide-react'; export default function KnowledgeBase() { const [techniques, setTechniques] = useState([]); const [competition, setCompetition] = useState(''); const [loading, setLoading] = useState(false); const fetchTechniques = async () => { setLoading(true); try { const response = await fetch(`/api/database/techniques${competition ? `?competition=${competition}` : ''}`); const data = await response.json(); setTechniques(data); } catch (error) { console.error('Failed to fetch techniques:', error); } finally { setLoading(false); } }; const generateConfig = async () => { try { const response = await fetch('/api/config/generate', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ competition, minConfidence: 0.8 }), }); const blob = await response.blob(); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'harvested_config.yaml'; a.click(); } catch (error) { console.error('Failed to generate config:', error); } }; useEffect(() => { fetchTechniques(); }, []); return (

Knowledge Base

Extracted Techniques
setCompetition(e.target.value)} className="input-field flex-1" />
{loading ? (
Loading...
) : (
{techniques.map((technique) => ( ))}
Parameter Value Confidence Source
{technique.name} {technique.value}
{(technique.confidence * 100).toFixed(1)}%
{technique.rich_context ? 'AST' : 'Regex'}
)}
); }