From 821526295dd6fc3a2fd3817bdb3e902fcfc96cd7 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 19:12:21 +0000 Subject: [PATCH] feat: Add new chat and resize input --- src/components/chat/ChatInput.tsx | 2 +- src/components/chat/ChatSidebar.tsx | 5 +++-- src/components/chat/ChatView.tsx | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx index b0783f6..e8ccd0e 100644 --- a/src/components/chat/ChatInput.tsx +++ b/src/components/chat/ChatInput.tsx @@ -90,7 +90,7 @@ export const ChatInput = ({ onSendMessage }: ChatInputProps) => { onChange={(e) => setMessage(e.target.value)} onKeyDown={handleKeyDown} placeholder="Digite sua mensagem..." - className="min-h-[60px] max-h-[200px] resize-none border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 pr-24" + className="min-h-[60px] max-h-[400px] resize-y border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 pr-24" />
diff --git a/src/components/chat/ChatSidebar.tsx b/src/components/chat/ChatSidebar.tsx index 724d453..4cfda04 100644 --- a/src/components/chat/ChatSidebar.tsx +++ b/src/components/chat/ChatSidebar.tsx @@ -46,9 +46,10 @@ interface ChatFolder { interface ChatSidebarProps { isCollapsed: boolean; onToggleCollapse: () => void; + onNewChat: () => void; } -export const ChatSidebar = ({ isCollapsed, onToggleCollapse }: ChatSidebarProps) => { +export const ChatSidebar = ({ isCollapsed, onToggleCollapse, onNewChat }: ChatSidebarProps) => { const [searchQuery, setSearchQuery] = useState(""); const [isCreateFolderOpen, setIsCreateFolderOpen] = useState(false); const [isEditFolderOpen, setIsEditFolderOpen] = useState(false); @@ -218,7 +219,7 @@ export const ChatSidebar = ({ isCollapsed, onToggleCollapse }: ChatSidebarProps) />
- diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx index 1097e83..f0595d9 100644 --- a/src/components/chat/ChatView.tsx +++ b/src/components/chat/ChatView.tsx @@ -20,6 +20,7 @@ interface Message { export const ChatView = () => { const [isChatSidebarCollapsed, setIsChatSidebarCollapsed] = useState(false); const [selectedModel, setSelectedModel] = useState("ChatGPT 4.1"); + const [currentChatId, setCurrentChatId] = useState("1"); const [messages, setMessages] = useState([ { id: "1", @@ -31,6 +32,19 @@ export const ChatView = () => { const [isLoading, setIsLoading] = useState(false); + const handleNewChat = () => { + const newChatId = Date.now().toString(); + setCurrentChatId(newChatId); + setMessages([ + { + id: "1", + role: "assistant", + content: "Olá! Sou o assistente HGTX Codex. Como posso ajudá-lo hoje?", + model: selectedModel, + }, + ]); + }; + const handleSendMessage = (content: string, files?: File[]) => { const newMessage: Message = { id: Date.now().toString(), @@ -66,6 +80,7 @@ export const ChatView = () => { setIsChatSidebarCollapsed(!isChatSidebarCollapsed)} + onNewChat={handleNewChat} /> {/* Main Chat Area */}