@zero-library/chat-agent 2.3.16 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -1 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
# @zero-library/chat-agent
|
|
2
|
+
|
|
3
|
+
AI 会话 UI 组件库。提供页面级聊天组件 `ChatCopilot`,并内置会话/消息编排、HTTP 服务封装、WebSocket 收消息、文件预览等能力。
|
|
4
|
+
|
|
5
|
+
该文档只维护稳定信息(安装、入口、能力、开发方式)。所有具体类型/方法以源码与类型注释为准,避免文档与实现重复维护。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @zero-library/chat-agent
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
样式(建议在应用入口引入一次):
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import '@zero-library/chat-agent/style'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { ChatCopilot } from '@zero-library/chat-agent'
|
|
23
|
+
import '@zero-library/chat-agent/style'
|
|
24
|
+
|
|
25
|
+
export default function App() {
|
|
26
|
+
return <ChatCopilot config={{ receiverType: 3, receiverId: 'agent-001' }} services={{ http: { config: { baseURL: '/api' } } }} />
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 能力与边界
|
|
31
|
+
|
|
32
|
+
- 组件:`ChatCopilot`(主聊天 UI),以及少量通用子组件(发言框/附件/消息渲染)
|
|
33
|
+
- 状态:Valtio store 统一管理会话、消息、预览等
|
|
34
|
+
- HTTP:内置服务层,默认基于 `@zero-library/common` 的请求封装
|
|
35
|
+
- WebSocket:支持配置主/备地址,提升可用性
|
|
36
|
+
- 预览:支持 URL 文件预览与 Markdown 文本预览
|
|
37
|
+
|
|
38
|
+
## 入口与结构
|
|
39
|
+
|
|
40
|
+
- 对外导出入口:`src/index.ts`
|
|
41
|
+
- UI:`src/ui`
|
|
42
|
+
- 状态与业务编排:`src/stores`
|
|
43
|
+
- 服务与类型:`src/services`
|
|
44
|
+
|
|
45
|
+
## 开发
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm --filter=chat-agent run dev
|
|
49
|
+
pnpm --filter=chat-agent run build
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 维护约定
|
|
53
|
+
|
|
54
|
+
- README 仅描述稳定能力与使用约定,不罗列具体方法列表
|
|
55
|
+
- API/类型说明以源码的类型与注释为准(例如 `src/ui/layouts/types.ts`、`src/stores/types.ts`、`src/services/*.ts`)
|
package/dist/index.cjs.js
CHANGED
|
@@ -593,7 +593,7 @@ function createChatStore() {
|
|
|
593
593
|
if (file?.fileUrl) {
|
|
594
594
|
window.open(file.fileUrl, "_blank");
|
|
595
595
|
} else if (file?.content) {
|
|
596
|
-
|
|
596
|
+
antd.message.warning("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9884\u89C8");
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
config.hooks?.onAfterFilePreview?.(file, preview);
|