import { Plus, Trash2 } from 'lucide-react' import { useChatStore } from '@/stores/chatStore' export const ChatSidebar = () => { const { chats, currentChatId, createChat, deleteChat, selectChat } = useChatStore() const handleNewChat = () => { createChat() } return (
{chats.map((chat) => (
selectChat(chat.id)} className={`group flex items-center justify-between px-3 py-2 rounded-md cursor-pointer text-sm mb-1 transition-colors ${ currentChatId === chat.id ? 'bg-[#343541] text-white' : 'text-gray-300 hover:bg-[#343541]/50' }`} > {chat.title}
))} {chats.length === 0 && (
暂无对话
)}
) }