import { useState, useEffect } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Brain, ChevronDown, ChevronUp, Zap, History } from 'lucide-react' import { useStore } from '../store/useStore' import { fetchPromptHistory } from '../lib/api' const SEED_PROMPT = `You are a SQL expert. Given a natural language question and a SQLite database schema, write a correct SQL query. Rules: - Output ONLY the SQL query, nothing else - No markdown, no code fences, no explanation - Use SQLite syntax - Always qualify column names with table aliases when using JOINs` export function PromptEvolution() { const { currentPrompt, promptGeneration, promptHistory, setPromptData } = useStore() const [expanded, setExpanded] = useState(false) const [historyExpanded, setHistoryExpanded] = useState(false) const [loading, setLoading] = useState(false) const prompt = currentPrompt || SEED_PROMPT const generation = promptGeneration const loadHistory = async () => { setLoading(true) try { const data = await fetchPromptHistory() setPromptData(data) } catch { // noop } finally { setLoading(false) } } useEffect(() => { void loadHistory() // eslint-disable-next-line react-hooks/exhaustive-deps }, []) return (
{prompt}
{snap.summary}
{snap.timestamp}