From 58a226a86fdca1a9c12f369cda45e2f1df8ae1d9 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 20:23:39 +0000 Subject: [PATCH] Add personality option to chat --- src/components/chat/ChatInput.tsx | 59 +++++++++++++++++++++++++++++-- src/components/chat/ChatView.tsx | 9 +++-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx index 5de6f0d..5a9ba12 100644 --- a/src/components/chat/ChatInput.tsx +++ b/src/components/chat/ChatInput.tsx @@ -1,18 +1,30 @@ -import { Send, Paperclip, X, GripHorizontal } from "lucide-react"; +import { Send, Paperclip, X, GripHorizontal, UserCog } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; import { useState, useRef, useEffect } from "react"; import { useToast } from "@/hooks/use-toast"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; interface ChatInputProps { onSendMessage: (message: string, files?: File[]) => void; + systemPrompt: string; + onSystemPromptChange: (prompt: string) => void; } -export const ChatInput = ({ onSendMessage }: ChatInputProps) => { +export const ChatInput = ({ onSendMessage, systemPrompt, onSystemPromptChange }: ChatInputProps) => { const [message, setMessage] = useState(""); const [attachedFiles, setAttachedFiles] = useState([]); const [textareaHeight, setTextareaHeight] = useState(60); const [isDragging, setIsDragging] = useState(false); + const [isPersonalityOpen, setIsPersonalityOpen] = useState(false); + const [tempSystemPrompt, setTempSystemPrompt] = useState(systemPrompt); const fileInputRef = useRef(null); const textareaRef = useRef(null); const dragStartY = useRef(0); @@ -91,6 +103,11 @@ export const ChatInput = ({ onSendMessage }: ChatInputProps) => { setAttachedFiles(attachedFiles.filter((_, i) => i !== index)); }; + const handleSavePersonality = () => { + onSystemPromptChange(tempSystemPrompt); + setIsPersonalityOpen(false); + }; + return (
@@ -158,6 +175,44 @@ export const ChatInput = ({ onSendMessage }: ChatInputProps) => { onChange={handleFileSelect} accept=".pdf,.txt,.doc,.docx,.xls,.xlsx,.csv,.png,.jpg,.jpeg,.gif,.webp" /> + + + + + + + Personalidade da IA + + Defina o estilo, tom ou função da IA nesta conversa + + +