UNPKG

@alauda/doom

Version:

Doctor Doom making docs.

9 lines (8 loc) 1.07 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { clsx } from 'clsx'; import { ChatRefDocs } from './ChatRefDocs/index.js'; import { ThinkingProcess } from './ThinkingProcess/index.js'; import AssistantIcon from '@alauda/doom/assets/assistant.svg?react'; import { Markdown } from '@alauda/doom/runtime'; import classes from '@alauda/doom/styles/chat.module.scss'; export const Chat = ({ ref, messages }) => (_jsx("ul", { ref: ref, className: classes.container, children: messages.map(({ id, role, content, thoughtProcess, refDocs }) => (_jsxs("li", { className: clsx(classes.chat, classes[role]), children: [role === 'assistant' && _jsx(AssistantIcon, { className: classes.icon }), _jsxs("div", { className: classes.content, children: [thoughtProcess && (_jsx(ThinkingProcess, { children: thoughtProcess })), refDocs?.length ? _jsx(ChatRefDocs, { refDocs: refDocs }) : null, typeof content === 'string' ? (_jsx("div", { className: clsx(classes.markdown), children: _jsx(Markdown, { children: content }) })) : (content)] })] }, `${role}-${id}`))) }));