"use client"; import { DragDropContext, Droppable, OnDragEndResponder, } from "@hello-pangea/dnd"; import { useAppConfig, useChatStore } from "@/app/store"; import Locale from "@/app/locales"; // import { useLocation, useNavigate } from "react-router-dom"; import { useRouter, usePathname } from "next/navigation"; import AddIcon from "@/app/icons/addIcon.svg"; import NextChatTitle from "@/app/icons/nextchatTitle.svg"; import Modal from "@/app/components/Modal"; import SessionItem from "@/app/containers/Chat/components/SessionItem"; export default function Page() { const [sessions, selectedIndex, selectSession, moveSession] = useChatStore( (state) => [ state.sessions, state.currentSessionIndex, state.selectSession, state.moveSession, ], ); const config = useAppConfig(); const { isMobileScreen } = config; const chatStore = useChatStore(); const pathname = usePathname(); const onDragEnd: OnDragEndResponder = (result) => { const { destination, source } = result; if (!destination) { return; } if ( destination.droppableId === source.droppableId && destination.index === source.index ) { return; } moveSession(source.index, destination.index); }; return (
{ // if (config.dontShowMaskSplashScreen) { // chatStore.newSession(); // navigate(Path.Chat); // } else { // navigate(Path.NewChat); // } }} >
Build your own AI assistant.
{(provided) => (
{sessions.map((item, i) => ( { // navigate(Path.Chat); // selectSession(i); }} onDelete={async () => { if ( await Modal.warn({ okText: Locale.ChatItem.DeleteOkBtn, cancelText: Locale.ChatItem.DeleteCancelBtn, title: Locale.ChatItem.DeleteTitle, content: Locale.ChatItem.DeleteContent, }) ) { chatStore.deleteSession(i); } }} mask={item.mask} isMobileScreen={isMobileScreen} /> ))} {provided.placeholder}
)}
); }