import React from "react"; import ActionButton from "./Button/ActionButton.jsx"; export default function ChatHeader({ title = "AI Assistant" }) { // Delete chat log (frontend + backend) const handleDeleteChat = async () => { if (!window.confirm("Delete all messages?")) return; await fetch(`/api/chat/${conversationId}`, { method: "DELETE" }); setMessages([]); }; // Restart chat (new conversation) const handleNewChat = async () => { const res = await fetch("/api/chat/new", { method: "POST" }); const data = await res.json(); if (data.success) { setConversationId(data.conversationId); setMessages([]); } }; return (
AI

{title}

Ask anything — AI is listening

); }