"use client"; import { useMemo, useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { SimpleThemeToggle } from "@/components/ui/simple-theme-toggle"; import { Clock, Info, Lock, MessageCircle, Plus, Upload, } from "lucide-react"; interface HistoryEntry { id: string; text: string; createdAt: string; } interface AIAssistantInterfaceProps { onOpenDocuments?: () => void; onOpenChat?: () => void; history?: HistoryEntry[]; onAddHistory?: (entry: HistoryEntry) => void; onClearHistory?: () => void; } export function AIAssistantInterface({ onOpenDocuments, onOpenChat, history: externalHistory, onAddHistory, onClearHistory, }: AIAssistantInterfaceProps) { const [question, setQuestion] = useState(""); const [drawerOpen, setDrawerOpen] = useState(false); const [internalHistory, setInternalHistory] = useState([]); const history = externalHistory ?? internalHistory; const showHistoryBadge = useMemo(() => history.length > 0, [history.length]); const handleDocuments = () => { if (onOpenDocuments) { onOpenDocuments(); return; } console.log("[ZoeIA] Abrir fluxo de documentos"); }; const handleOpenRealtimeChat = () => { if (onOpenChat) { onOpenChat(); return; } console.log("[ZoeIA] Abrir chat em tempo real"); }; const handleSendMessage = () => { const trimmed = question.trim(); if (!trimmed) return; handlePersistHistory(trimmed); console.log("[ZoeIA] Mensagem enviada para Zoe", trimmed); setQuestion(""); }; const RealtimeTriggerButton = () => ( ); const handlePersistHistory = (text: string) => { const entry: HistoryEntry = { id: `hist-${Date.now()}`, text, createdAt: new Date().toISOString(), }; if (onAddHistory) { onAddHistory(entry); } else { setInternalHistory((prev) => [...prev, entry]); } setDrawerOpen(true); }; const handleClearHistory = () => { if (onClearHistory) { onClearHistory(); } else { setInternalHistory([]); } }; const HistoryGlyph = () => ( ); return (
Zoe

Assistente Clínica Zoe

Olá, eu sou Zoe. Como posso ajudar hoje?

Suas informações permanecem criptografadas e seguras com a equipe Zoe.
Informativo importante

A Zoe é a assistente virtual da Clínica Zoe. Ela reúne informações sobre seus cuidados e orienta os próximos passos. O atendimento é informativo e não substitui a avaliação de um profissional de saúde qualificado.

Em situações de urgência, procure imediatamente o suporte médico presencial ou ligue para os serviços de emergência.

Estamos reunindo o histórico da sua jornada. Enquanto isso, você pode anexar exames, enviar dúvidas ou solicitar contato com a equipe Zoe.

setQuestion(event.target.value)} onKeyDown={(event) => { if (event.key === "Enter") { event.preventDefault(); handleSendMessage(); } }} placeholder="Pergunte qualquer coisa para a Zoe" className="border-none bg-transparent text-sm shadow-none focus-visible:ring-0" />
{drawerOpen && ( )}
); }