Skip to content

AI 组件概览 ​

dan-ui 的 AI 组件只负责界面、事件与插槽,不内置任何大模型接口。

快速体验 ​

下面是完整假流式对话演示:

输入 0·输出 0·合计 0
助手

你好,我是 dan-ui 演示助手。发送一条消息试试假流式输出。

接入方式 ​

  1. 用 DanChat 展示消息列表
  2. 用 DanChatInput 收集输入并触发 send
  3. 业务侧请求 SSE / WebSocket,把增量写入消息 content
  4. 响应 stop,并把消息 status 设为 stopped

消息模型 ​

ts
interface ChatMessageModel {
  id: string
  role: 'user' | 'assistant' | 'system' | 'tool'
  content: string
  status?: 'pending' | 'streaming' | 'done' | 'error' | 'stopped'
  reasoning?: string
  attachments?: ChatAttachment[]
}