import React, { useMemo, useState } from "react"; import { motion } from "motion/react"; import { Rocket } from "lucide-react"; import DeleteButton from "src/components/ui/button/delete-button"; import FileList from "src/components/ui/file/file-list"; export default function ChatHeader({ title = "Schematic Spelunker", onDeleteAll, }) { const isDebug = useMemo(() => { const p = new URLSearchParams(window.location.search); return p.get("debug") === "1"; }, []); const [ingesting, setIngesting] = useState(false); const [toast, setToast] = useState(""); async function triggerDemoIngest() { try { setIngesting(true); const res = await fetch("/api/files/import-demo", { method: "POST" }); const json = await res.json().catch(() => ({})); setToast( `Imported: ${json.imported ?? "?"}, Skipped: ${json.skipped ?? "?"}` ); setTimeout(() => setToast(""), 4000); } catch (e) { setToast("Import failed"); setTimeout(() => setToast(""), 4000); } finally { setIngesting(false); } } return (