@plteam/chat-ui
Version:
CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript
24 lines (23 loc) • 1.22 kB
JavaScript
import * as React from 'react';
import NewChatButton from './NewChatButton';
import Box from '@mui/material/Box';
import SimpleScrollbar from '../../ui/SimpleScrollbar';
import ThreadsListMapBlock from './listMap/ThreadsListMapBlock';
import { useHistoryContext } from '../core/history/HistoryContext';
const ChatHistory = () => {
const { slots, slotProps, apiRef, locale } = useHistoryContext();
const openNewThread = () => {
const thread = apiRef.current?.handleCreateNewThread?.();
if (thread) {
apiRef.current?.openNewThread(thread);
}
};
return (React.createElement(slots.historyWrapper, { gap: 2, height: "100%", width: "100%", ...slotProps.historyWrapper },
React.createElement(NewChatButton, { openNewThread: openNewThread }),
React.createElement(Box, { mx: 2, mb: 0.5 },
React.createElement(slots.listSubtitle, { ...slotProps.listSubtitle }, locale.historyTitle)),
React.createElement(Box, { overflow: "hidden" },
React.createElement(SimpleScrollbar, { style: { maxHeight: '100%' } },
React.createElement(ThreadsListMapBlock, null)))));
};
export default ChatHistory;