feat: Add new chat and resize input
This commit is contained in:
@@ -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"
|
||||
/>
|
||||
|
||||
<div className="absolute right-2 bottom-2 flex items-center gap-1">
|
||||
|
||||
@@ -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)
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button className="w-full gap-2 cyber-glow" variant="default">
|
||||
<Button className="w-full gap-2 cyber-glow" variant="default" onClick={onNewChat}>
|
||||
<Plus className="w-4 h-4" />
|
||||
Novo Chat
|
||||
</Button>
|
||||
|
||||
@@ -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<Message[]>([
|
||||
{
|
||||
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 = () => {
|
||||
<ChatSidebar
|
||||
isCollapsed={isChatSidebarCollapsed}
|
||||
onToggleCollapse={() => setIsChatSidebarCollapsed(!isChatSidebarCollapsed)}
|
||||
onNewChat={handleNewChat}
|
||||
/>
|
||||
|
||||
{/* Main Chat Area */}
|
||||
|
||||
Reference in New Issue
Block a user