Appearance
ai-chat-vue
Vue3 AI 聊天组件库 —— 聊天界面 · 思考链 · 智能输入框 · 附件卡片。
在线演示
安装
bash
# ai-chat-vue 依赖 Element Plus(peer)
pnpm add @flowporr/ai-chat-vue element-plus注册
ts
// 全局注册
import ElementPlusX from '@flowporr/ai-chat-vue'
import '@flowporr/ai-chat-vue/style'
app.use(ElementPlusX)
// 或按需引入
import { BubbleList, XSender } from '@flowporr/ai-chat-vue'组件结构
ConfigProvider(主题 + 命名空间配置)
├── Conversations(对话列表容器)
│ └── item
│ ├── Bubble(聊天气泡)
│ ├── ThoughtChain(思考链)
│ │ └── Thinking(单步思考)
│ ├── Attachments(附件列表)
│ │ └── FilesCard(文件卡片)× N
│ └── Prompts(引导提示词)
├── Welcome(欢迎页 / 空状态)
└── XSender(智能输入框)
├── SendButton / LoadingButton / ClearButton
└── x-sender(底层输入引擎)组件一览
| 组件 | 说明 | 文档 |
|---|---|---|
ConfigProvider | 全局配置(namespace / 主题 / autoDark) | 总览下方 |
Bubble | 聊天气泡(变体 / 形状 / 打字机) | Bubble |
BubbleList | 虚拟滚动对话列表 | Bubble |
Conversations | 高层对话容器 | Conversations |
Thinking / ThoughtChain | 思考链 | Thinking |
Attachments / FilesCard | 文件附件 | Attachments |
Prompts | 引导提示词 | Prompts |
Welcome | 欢迎页 / 空状态 | Welcome |
XSender | 智能输入框 | XSender |
ConfigProvider — 全局配置
在应用根组件提供命名空间前缀和主题覆盖。
| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
namespace | string | 'elx' | 全局 CSS 类名前缀 |
themeOverrides | ThemeOverrides | undefined | 主题变量覆盖 |
autoDark | boolean | true | 自动跟随系统暗色模式 |
vue
<ConfigProvider
namespace="my-app"
:theme-overrides="{ bubble: { bgColor: 'var(--js-surface)', borderRadius: '12px' } }"
:auto-dark="true"
>
<App />
</ConfigProvider>主题
组件用 --js-* 设计 token(--js-surface / --js-text / --js-primary 等),支持 6 套配色 × 2 模式。暗色走 [data-theme-mode='dark'] 选择器。文档站已内置一套 token,可在应用里覆盖。