@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
14 lines (13 loc) • 804 B
JavaScript
import * as React from 'react';
import Stack from '@mui/material/Stack';
import { ChatViewConstants } from '../ChatViewConstants';
import MessagesList from './MessagesList';
import { useThreadContext } from '../thread/ThreadContext';
import { useObserverValue } from '../hooks/useObserverValue';
const MessagesComponent = () => {
const { apiRef, thread } = useThreadContext();
const messages = useObserverValue(apiRef.current?.getListener('branch'));
const gap = 4;
return (React.createElement(Stack, { gap: gap, flex: 1, alignItems: "flex-start", maxWidth: "100%", width: "100%", id: ChatViewConstants.MESSAGE_BOX_ID }, !!thread && React.createElement(MessagesList, { thread: thread, messages: messages ?? [], gap: gap })));
};
export default React.memo(MessagesComponent);