What it actually does
AI analysis from the code graph — generated when you open this
loading…
README
服务于智能对话领域的设计和开发体系,助力智能对话机器人的搭建
官网:https://chatui.io

English | 简体中文
特性
- 基于阿里小蜜业务积累和打磨的对话式交互和视觉最佳实践
- 使用 TypeScript 开发,提供完整的类型定义文件
- 响应式布局,在无线和 PC 端都可以友好展现
- 支持无障碍,已通过深圳市无障碍研究会的认证
- 支持灵活的样式定制,以满足业务和品牌上多样化的视觉需求
- 支持多语言和本土化特性
兼容环境
需要支持 CSS Variables
安装
npm install @chatui/core --save
yarn add @chatui/core
示例
import Chat, { Bubble, useMessages } from '@chatui/core';
import '@chatui/core/dist/index.css';
const App = () => {
const { messages, appendMsg, setTyping } = useMessages([]);
function handleSend(type, val) {
if (type === 'text' && val.trim()) {
appendMsg({
type: 'text',
content: { text: val },
position: 'right',
});
setTyping(true);
setTimeout(() => {
appendMsg({
type: 'text',
content: { text: 'Bala bala' },
});
}, 1000);
}
}
function renderMessageContent(msg) {
const { content } = msg;
return <Bubble content={content.text} />;
}
return (
<Chat
navbar={{ title: '智能助理' }}
messages={messages}
renderMessageContent={renderMessageContent}
onSend={handleSend}
/>
);
};
定制主题
参考 定制主题 文档。
国际化
参考 国际化 文档。
交流讨论

License
MIT
Extension points exported contracts — how you extend this code
TimeLocale (Interface)
(no doc)
src/components/Time/parser.ts
Props (Interface)
(no doc)
src/utils/smoothScroll.ts
TimeProps (Interface)
(no doc)
src/components/Time/Time.tsx
ComposerHandle (Interface)
(no doc)
src/components/Composer/index.tsx
TagProps (Interface)
(no doc)
src/components/Tag/index.tsx
GoodsProps (Interface)
(no doc)
src/components/Goods/index.tsx
Core symbols most depended-on inside this repo
canUse
called by 7
src/utils/canUse.ts
getRandomString
called by 5
src/utils/index.ts
show
called by 3
src/components/Toast/index.tsx
setContentStyle
called by 3
src/components/PullToRefresh/index.tsx
reset
called by 3
src/components/PullToRefresh/index.tsx
slideToCurrent
called by 3
src/components/Carousel/index.tsx
goTo
called by 3
src/components/Carousel/index.tsx
autoPlayClear
called by 3
src/components/Carousel/index.tsx
Shape
Function
180
Interface
33
Method
25
Class
8
Modules by API surface
src/components/Carousel/index.tsx20 symbols
src/components/Composer/index.tsx19 symbols
src/components/PullToRefresh/index.tsx9 symbols
src/components/Recorder/index.tsx8 symbols
src/hooks/useMessages.ts7 symbols
src/components/Time/parser.ts6 symbols
src/components/Tabs/Tabs.tsx6 symbols
src/components/MessageContainer/index.tsx6 symbols
src/components/Video/index.tsx5 symbols
src/components/ErrorBoundary/index.tsx5 symbols
gulpfile.js5 symbols
storybook/stories/Chat.stories.tsx4 symbols
Dependencies from manifests, versioned
@babel/core7.11.6 · 1×
@babel/plugin-proposal-class-properties7.10.4 · 1×
@babel/plugin-transform-runtime7.11.5 · 1×
@babel/preset-env7.11.5 · 1×
@babel/preset-react7.10.4 · 1×
@babel/preset-typescript7.10.4 · 1×
@babel/runtime7.11.2 · 1×
@babel/runtime-corejs37.11.2 · 1×
@commitlint/cli11.0.0 · 1×
@commitlint/config-conventional11.0.0 · 1×
@rollup/plugin-babel5.2.1 · 1×
@rollup/plugin-commonjs15.0.0 · 1×