diff --git a/src/components/agent/AgentChat.tsx b/src/components/agent/AgentChat.tsx deleted file mode 100644 index 1b92085..0000000 --- a/src/components/agent/AgentChat.tsx +++ /dev/null @@ -1,195 +0,0 @@ -import { useState } from "react"; -import { Button } from "@/components/ui/button"; -import { Textarea } from "@/components/ui/textarea"; -import { Input } from "@/components/ui/input"; -import { Download, Send, Sparkles } from "lucide-react"; -import { LegalOpinion } from "./AgentView"; -import { ScrollArea } from "@/components/ui/scroll-area"; -import { useToast } from "@/hooks/use-toast"; - -interface AgentChatProps { - selectedOpinion: LegalOpinion | null; - isCreatingNew: boolean; - onOpinionCreated: (opinion: LegalOpinion) => void; -} - -export const AgentChat = ({ - selectedOpinion, - isCreatingNew, - onOpinionCreated, -}: AgentChatProps) => { - const [title, setTitle] = useState(""); - const [instructions, setInstructions] = useState(""); - const [category, setCategory] = useState(""); - const [generatedContent, setGeneratedContent] = useState(""); - const [isGenerating, setIsGenerating] = useState(false); - const { toast } = useToast(); - - const handleGenerate = async () => { - if (!instructions.trim()) { - toast({ - title: "Instruções necessárias", - description: "Por favor, forneça instruções para gerar o parecer.", - variant: "destructive", - }); - return; - } - - setIsGenerating(true); - - // Simulação de chamada à IA - aqui você integraria com a API real - setTimeout(() => { - const mockContent = `PARECER JURÍDICO - -TÍTULO: ${title || "Parecer Jurídico"} - -${instructions} - -ANÁLISE: - -Este parecer foi gerado com base nas instruções fornecidas. A análise considera os seguintes aspectos legais: - -1. Fundamentação Legal -2. Precedentes Judiciais -3. Doutrina Aplicável -4. Conclusão e Recomendações - -CONCLUSÃO: - -Com base na análise realizada, conclui-se que... - -___________________________ -Parecer gerado em ${new Date().toLocaleDateString('pt-BR')}`; - - setGeneratedContent(mockContent); - setIsGenerating(false); - - if (isCreatingNew) { - const newOpinion: LegalOpinion = { - id: Date.now().toString(), - title: title || "Novo Parecer", - content: mockContent, - createdAt: new Date(), - category: category || undefined, - }; - onOpinionCreated(newOpinion); - } - - toast({ - title: "Parecer gerado com sucesso!", - description: "O parecer está pronto para download.", - }); - }, 2000); - }; - - const handleDownloadDocx = () => { - // Aqui você implementaria a geração real do DOCX - // Por enquanto, vamos criar um arquivo de texto - const content = generatedContent || selectedOpinion?.content || ""; - const blob = new Blob([content], { type: 'text/plain' }); - const url = URL.createObjectURL(blob); - const a = document.createElement('a'); - a.href = url; - a.download = `${title || selectedOpinion?.title || 'parecer'}.txt`; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - URL.revokeObjectURL(url); - - toast({ - title: "Download iniciado", - description: "O parecer está sendo baixado.", - }); - }; - - const displayContent = generatedContent || selectedOpinion?.content; - - return ( -
- Criado em {new Date(selectedOpinion.createdAt).toLocaleDateString('pt-BR')} -
- )} -
- {displayContent}
-
- Nenhum parecer encontrado
-+ Mostrando {startIndex + 1} a {Math.min(startIndex + itemsPerPage, sortedOpinions.length)} de{" "} + {sortedOpinions.length} pareceres +
+