Installation
  Installation
Using your favorite package manager, install @plteam/chat-ui
npm i @plteam/chat-uiyarn add @plteam/chat-uiThe Chat UI package has a peer dependency on @mui/material. If you are not already using it in your project, you can install it with:
npm install @mui/material @emotion/react @emotion/styledyarn add @mui/material @emotion/react @emotion/styledPlease note that react and react-dom are peer dependencies too:
"peerDependencies": {
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},Example
ℹ️
To run the examples as they are, you need to use TypeScript.
  Collapse code
    Expand code
  <ChatPage
  thread={threads[0]}
  threads={threads}
  handleStopMessageStreaming={handleStopMessageStreaming}
  onUserMessageSent={onUserMessageSent}
/>import * as React from "react";
import {
  ChatPage,
  useAssistantAnswerMock,
  Thread,
} from "@plteam/chat-ui";
import Box from "@mui/material/Box";
const App: React.FC = () => {
  const [threads] = React.useState<Thread[]>([
    {
      id: "test-thread",
      title: "Welcome message",
      messages: [
        {
          role: "user",
          content: "Hello!",
        },
        {
          role: "assistant",
          content: "Hello there! How can I assist you today?",
        },
      ],
    },
  ]);
  const { onUserMessageSent, handleStopMessageStreaming } =
    useAssistantAnswerMock();
  return (
    <Box height={"100dvh"} width={"100%"}>
      <ChatPage
        thread={threads[0]}
        threads={threads}
        handleStopMessageStreaming={handleStopMessageStreaming}
        onUserMessageSent={onUserMessageSent}
      />
    </Box>
  );
}
export default App;