@ai-group/chat-sdk 0.2.5 → 0.2.8
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 +93 -214
- package/dist/cjs/assets/arrow-down.png +0 -0
- package/dist/cjs/assets/arrow-up.png +0 -0
- package/dist/cjs/assets/chatKnowledge.png +0 -0
- package/dist/cjs/assets/completed-black.png +0 -0
- package/dist/cjs/assets/completed.png +0 -0
- package/dist/cjs/assets/document-black.png +0 -0
- package/dist/cjs/assets/document.png +0 -0
- package/dist/cjs/assets/document.svg +16 -0
- package/dist/cjs/assets/empty.png +0 -0
- package/dist/cjs/assets/group.png +0 -0
- package/dist/cjs/assets/qa-black.png +0 -0
- package/dist/cjs/assets/qa.png +0 -0
- package/dist/cjs/assets/skillNo-black.png +0 -0
- package/dist/cjs/assets/skillNo.png +0 -0
- package/dist/cjs/assets/tools-black.png +0 -0
- package/dist/cjs/assets/tools.png +0 -0
- package/dist/cjs/assets/user.png +0 -0
- package/dist/cjs/client/base.d.ts +9 -0
- package/dist/cjs/client/base.js +18 -0
- package/dist/cjs/client/base.js.map +7 -0
- package/dist/cjs/client/restClient.d.ts +0 -0
- package/dist/cjs/client/restClient.js +1 -0
- package/dist/cjs/client/restClient.js.map +7 -0
- package/dist/cjs/client/wsClient.d.ts +0 -0
- package/dist/cjs/client/wsClient.js +1 -0
- package/dist/cjs/client/wsClient.js.map +7 -0
- package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.d.ts +10 -0
- package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.js +484 -0
- package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.js.map +7 -0
- package/dist/cjs/components/XAiChatbot/index.d.ts +12 -0
- package/dist/cjs/components/XAiChatbot/index.js +365 -0
- package/dist/cjs/components/XAiChatbot/index.js.map +7 -0
- package/dist/cjs/components/XAiChatbot/styles.d.ts +72 -0
- package/dist/cjs/components/XAiChatbot/styles.js +426 -0
- package/dist/cjs/components/XAiChatbot/styles.js.map +7 -0
- package/dist/cjs/components/XAiProvider/XAiProvider.stories.d.ts +7 -0
- package/dist/cjs/components/XAiProvider/XAiProvider.stories.js +127 -0
- package/dist/cjs/components/XAiProvider/XAiProvider.stories.js.map +7 -0
- package/dist/cjs/components/XAiProvider/index.d.ts +4 -0
- package/dist/cjs/components/XAiProvider/index.js +115 -0
- package/dist/cjs/components/XAiProvider/index.js.map +7 -0
- package/dist/cjs/components/XAiSDK.d.ts +10 -0
- package/dist/cjs/components/XAiSDK.js +53 -0
- package/dist/cjs/components/XAiSDK.js.map +7 -0
- package/dist/cjs/components/XAiWebSDKWrapper.d.ts +9 -0
- package/dist/cjs/components/XAiWebSDKWrapper.js +70 -0
- package/dist/cjs/components/XAiWebSDKWrapper.js.map +7 -0
- package/dist/cjs/context/AiProviderContext.d.ts +12 -0
- package/dist/cjs/context/AiProviderContext.js +74 -0
- package/dist/cjs/context/AiProviderContext.js.map +7 -0
- package/dist/cjs/context/ThemeContext.d.ts +20 -0
- package/dist/cjs/context/ThemeContext.js +37 -0
- package/dist/cjs/context/ThemeContext.js.map +7 -0
- package/dist/cjs/hooks/useAgentGenerator.d.ts +72 -0
- package/dist/cjs/hooks/useAgentGenerator.js +487 -0
- package/dist/cjs/hooks/useAgentGenerator.js.map +7 -0
- package/dist/cjs/hooks/useEventStreamRequest.d.ts +30 -0
- package/dist/cjs/hooks/useEventStreamRequest.js +188 -0
- package/dist/cjs/hooks/useEventStreamRequest.js.map +7 -0
- package/dist/cjs/hooks/useProviderContext.d.ts +33 -0
- package/dist/cjs/hooks/useProviderContext.js +105 -0
- package/dist/cjs/hooks/useProviderContext.js.map +7 -0
- package/dist/cjs/hooks/useXAiSDK.d.ts +14 -0
- package/dist/cjs/hooks/useXAiSDK.js +75 -0
- package/dist/cjs/hooks/useXAiSDK.js.map +7 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +61 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/services/api.d.ts +69 -0
- package/dist/cjs/services/api.js +49 -0
- package/dist/cjs/services/api.js.map +7 -0
- package/dist/cjs/styles/common.d.ts +64 -0
- package/dist/cjs/styles/common.js +144 -0
- package/dist/cjs/styles/common.js.map +7 -0
- package/dist/cjs/styles/markdown.d.ts +3 -0
- package/dist/cjs/styles/markdown.js +193 -0
- package/dist/cjs/styles/markdown.js.map +7 -0
- package/dist/cjs/types/XAiChatbot.d.ts +159 -0
- package/dist/cjs/types/XAiChatbot.js +18 -0
- package/dist/cjs/types/XAiChatbot.js.map +7 -0
- package/dist/cjs/types/XAiMessage.d.ts +121 -0
- package/dist/cjs/types/XAiMessage.js +55 -0
- package/dist/cjs/types/XAiMessage.js.map +7 -0
- package/dist/cjs/types/XAiProvider.d.ts +46 -0
- package/dist/cjs/types/XAiProvider.js +50 -0
- package/dist/cjs/types/XAiProvider.js.map +7 -0
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/index.js +28 -0
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/types/mdx.d.ts +18 -0
- package/dist/cjs/utils/chat.d.ts +34 -0
- package/dist/cjs/utils/chat.js +1 -0
- package/dist/cjs/utils/chat.js.map +7 -0
- package/dist/cjs/utils/index.d.ts +2 -0
- package/dist/cjs/utils/index.js +49 -0
- package/dist/cjs/utils/index.js.map +7 -0
- package/dist/cjs/utils/providerManager.d.ts +22 -0
- package/dist/cjs/utils/providerManager.js +73 -0
- package/dist/cjs/utils/providerManager.js.map +7 -0
- package/dist/cjs/utils/request.d.ts +78 -0
- package/dist/cjs/utils/request.example.d.ts +39 -0
- package/dist/cjs/utils/request.example.js +211 -0
- package/dist/cjs/utils/request.example.js.map +7 -0
- package/dist/cjs/utils/request.js +231 -0
- package/dist/cjs/utils/request.js.map +7 -0
- package/dist/cjs/utils/umdEntry.d.ts +14 -0
- package/dist/cjs/utils/umdEntry.js +97 -0
- package/dist/cjs/utils/umdEntry.js.map +7 -0
- package/dist/esm/assets/user.png +0 -0
- package/dist/esm/client/base.d.ts +9 -0
- package/dist/esm/client/restClient.d.ts +0 -0
- package/dist/esm/client/wsClient.d.ts +0 -0
- package/dist/esm/components/XAiChatbot/XAiChatbot.stories.d.ts +10 -0
- package/dist/esm/components/XAiChatbot/index.d.ts +12 -0
- package/dist/esm/components/XAiChatbot/index.js +17 -11
- package/dist/esm/components/XAiChatbot/index.js.map +1 -1
- package/dist/esm/components/XAiChatbot/styles.d.ts +72 -0
- package/dist/esm/components/XAiChatbot/styles.js +37 -38
- package/dist/esm/components/XAiChatbot/styles.js.map +1 -1
- package/dist/esm/components/XAiProvider/XAiProvider.stories.d.ts +7 -0
- package/dist/esm/components/XAiProvider/index.d.ts +4 -0
- package/dist/esm/components/XAiProvider/index.js +8 -1
- package/dist/esm/components/XAiProvider/index.js.map +1 -1
- package/dist/esm/components/XAiSDK.d.ts +10 -0
- package/dist/esm/components/XAiWebSDKWrapper.d.ts +9 -0
- package/dist/esm/components/XAiWebSDKWrapper.js +4 -1
- package/dist/esm/components/XAiWebSDKWrapper.js.map +1 -1
- package/dist/esm/context/AiProviderContext.d.ts +12 -0
- package/dist/esm/context/ThemeContext.d.ts +20 -0
- package/dist/esm/hooks/useAgentGenerator.d.ts +72 -0
- package/dist/esm/hooks/useAgentGenerator.js +113 -39
- package/dist/esm/hooks/useAgentGenerator.js.map +1 -1
- package/dist/esm/hooks/useEventStreamRequest.d.ts +30 -0
- package/dist/esm/hooks/useProviderContext.d.ts +33 -0
- package/dist/esm/hooks/useXAiSDK.d.ts +14 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/services/api.d.ts +69 -0
- package/dist/esm/services/api.js.map +1 -1
- package/dist/esm/styles/common.d.ts +64 -0
- package/dist/esm/styles/markdown.d.ts +3 -0
- package/dist/esm/types/XAiChatbot.d.ts +159 -0
- package/dist/esm/types/XAiMessage.d.ts +121 -0
- package/dist/esm/types/XAiProvider.d.ts +46 -0
- package/dist/esm/types/XAiProvider.js +7 -0
- package/dist/esm/types/XAiProvider.js.map +1 -1
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/esm/utils/chat.d.ts +34 -0
- package/dist/esm/utils/index.d.ts +2 -0
- package/dist/esm/utils/providerManager.d.ts +22 -0
- package/dist/esm/utils/request.d.ts +78 -0
- package/dist/esm/utils/request.example.d.ts +39 -0
- package/dist/esm/utils/umdEntry.d.ts +14 -0
- package/dist/esm/utils/umdEntry.js +22 -18
- package/dist/esm/utils/umdEntry.js.map +1 -1
- package/dist/umd/chat-sdk.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,239 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# XAi Web SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个用于集成 AI 聊天机器人的 Web SDK。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @x-group/chat-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## 使用方法
|
|
12
12
|
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
13
|
+
### 方式一:推荐写法(Coze 风格)
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import XAiWebSDK from '@x-group/chat-sdk';
|
|
17
|
+
|
|
18
|
+
// 创建 SDK 实例 - 类似 Coze 的写法
|
|
19
|
+
const chatbot = new XAiWebSDK.initChatbot({
|
|
20
|
+
url: 'https://your-api-server.com',
|
|
21
|
+
token: 'your-token',
|
|
22
|
+
config: {
|
|
23
|
+
appNo: 'your-app-no',
|
|
24
|
+
pt: 'platform',
|
|
25
|
+
tc: 'tenant',
|
|
26
|
+
},
|
|
27
|
+
componentProps: {
|
|
28
|
+
id: 'chatbot-container',
|
|
29
|
+
width: '400px',
|
|
30
|
+
height: '600px',
|
|
31
|
+
},
|
|
32
|
+
onError: (error) => {
|
|
33
|
+
console.error('Chatbot init error:', error);
|
|
34
|
+
},
|
|
35
|
+
onSuccess: (appInfo) => {
|
|
36
|
+
console.log('Chatbot init success:', appInfo);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// 销毁实例
|
|
41
|
+
chatbot.unmount();
|
|
46
42
|
```
|
|
47
43
|
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</XAiProvider>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
44
|
+
### 方式二:兼容写法
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
// 使用静态方法(不推荐,但保持兼容)
|
|
48
|
+
const chatbot = XAiWebSDK.create({
|
|
49
|
+
url: 'https://your-api-server.com',
|
|
50
|
+
token: 'your-token',
|
|
51
|
+
config: {
|
|
52
|
+
appNo: 'your-app-no',
|
|
53
|
+
pt: 'platform',
|
|
54
|
+
tc: 'tenant',
|
|
55
|
+
},
|
|
56
|
+
componentProps: {
|
|
57
|
+
id: 'chatbot-container',
|
|
58
|
+
},
|
|
59
|
+
onError: (error) => {
|
|
60
|
+
console.error('Chatbot init error:', error);
|
|
61
|
+
},
|
|
62
|
+
onSuccess: (appInfo) => {
|
|
63
|
+
console.log('Chatbot init success:', appInfo);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
73
66
|
```
|
|
74
67
|
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
title: 'Provider 1',
|
|
95
|
-
subtitle: '第一个聊天机器人',
|
|
96
|
-
}}
|
|
97
|
-
/>
|
|
98
|
-
</XAiProvider>
|
|
99
|
-
|
|
100
|
-
{/* 第二个聊天机器人 */}
|
|
101
|
-
<XAiProvider
|
|
102
|
-
url="https://api.example.com/ai"
|
|
103
|
-
token="token-2"
|
|
104
|
-
providerId="provider-2"
|
|
105
|
-
>
|
|
106
|
-
<XAiChatbot
|
|
107
|
-
navbarShow={true}
|
|
108
|
-
navbar={{
|
|
109
|
-
title: 'Provider 2',
|
|
110
|
-
subtitle: '第二个聊天机器人',
|
|
111
|
-
}}
|
|
112
|
-
/>
|
|
113
|
-
</XAiProvider>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
68
|
+
### 方式三:直接指定容器
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
const container = document.getElementById('my-chatbot');
|
|
72
|
+
const chatbot = new XAiWebSDK(container, {
|
|
73
|
+
url: 'https://your-api-server.com',
|
|
74
|
+
token: 'your-token',
|
|
75
|
+
config: {
|
|
76
|
+
appNo: 'your-app-no',
|
|
77
|
+
pt: 'platform',
|
|
78
|
+
tc: 'tenant',
|
|
79
|
+
},
|
|
80
|
+
onError: (error) => {
|
|
81
|
+
console.error('Chatbot init error:', error);
|
|
82
|
+
},
|
|
83
|
+
onSuccess: (appInfo) => {
|
|
84
|
+
console.log('Chatbot init success:', appInfo);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
117
87
|
```
|
|
118
88
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Provider 模式支持自定义消息处理逻辑:
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import { XAiProvider, XAiChatbot } from '@ai-group/chat-sdk';
|
|
125
|
-
|
|
126
|
-
function App() {
|
|
127
|
-
return (
|
|
128
|
-
<XAiProvider
|
|
129
|
-
url="https://api.example.com/ai"
|
|
130
|
-
token="your-token-here"
|
|
131
|
-
providerId="custom-provider"
|
|
132
|
-
>
|
|
133
|
-
<XAiChatbot
|
|
134
|
-
navbarShow={true}
|
|
135
|
-
navbar={{
|
|
136
|
-
title: '自定义处理',
|
|
137
|
-
subtitle: '自定义消息处理逻辑',
|
|
138
|
-
}}
|
|
139
|
-
messageActions={[
|
|
140
|
-
{
|
|
141
|
-
key: 'custom',
|
|
142
|
-
icon: <span>🔧</span>,
|
|
143
|
-
tooltip: '自定义操作',
|
|
144
|
-
},
|
|
145
|
-
]}
|
|
146
|
-
onMessagesActionsCallback={(index, data) => {
|
|
147
|
-
console.log('自定义操作:', index, data);
|
|
148
|
-
}}
|
|
149
|
-
/>
|
|
150
|
-
</XAiProvider>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Provider 模式的优势
|
|
156
|
-
|
|
157
|
-
### 1. 自动消息管理
|
|
158
|
-
- Provider 自动处理消息的发送、接收、状态更新
|
|
159
|
-
- 支持流式响应和实时更新
|
|
160
|
-
- 自动处理错误状态和重试机制
|
|
161
|
-
|
|
162
|
-
### 2. 统一的状态管理
|
|
163
|
-
- 所有聊天机器人的状态都在 Provider 中统一管理
|
|
164
|
-
- 支持消息历史记录、清空、重新生成等功能
|
|
165
|
-
- 提供 loading 状态和错误处理
|
|
166
|
-
|
|
167
|
-
### 3. 灵活的配置
|
|
168
|
-
- 支持多个 Provider 实例,每个实例可以有不同的配置
|
|
169
|
-
- 支持 Token 刷新机制
|
|
170
|
-
- 支持自定义 AI 客户端配置
|
|
171
|
-
|
|
172
|
-
### 4. 向后兼容
|
|
173
|
-
- XAiChatbot 可以独立使用,不依赖 Provider
|
|
174
|
-
- 现有的回调函数(onSend、onClear、onStop)仍然有效
|
|
175
|
-
- 可以平滑迁移到 Provider 模式
|
|
89
|
+
## API 参数
|
|
176
90
|
|
|
177
|
-
|
|
91
|
+
### XAiSDKProps
|
|
178
92
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
| 属性 | 类型 | 必填 | 说明 |
|
|
93
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
182
94
|
|------|------|------|------|
|
|
183
95
|
| url | string | 是 | AI 服务地址 |
|
|
184
96
|
| token | string | 是 | 认证 token |
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
189
|
-
### XAiChatbot Props
|
|
190
|
-
|
|
191
|
-
XAiChatbot 支持所有原有的 props,同时在使用 Provider 时会自动使用 Provider 的状态和方法。
|
|
192
|
-
|
|
193
|
-
## 样式覆盖
|
|
194
|
-
|
|
195
|
-
### 覆盖 .ant-sender 样式
|
|
196
|
-
|
|
197
|
-
你可以通过以下方式覆盖 Sender 组件的样式:
|
|
198
|
-
|
|
199
|
-
```tsx
|
|
200
|
-
// 在 GlobalStyle 中添加
|
|
201
|
-
export const GlobalStyle: React.FC = () => (
|
|
202
|
-
<Global
|
|
203
|
-
styles={globalCss`
|
|
204
|
-
.ant-sender {
|
|
205
|
-
/* 在这里添加你想要覆盖的样式 */
|
|
206
|
-
border-radius: 8px !important;
|
|
207
|
-
background-color: #f5f5f5 !important;
|
|
208
|
-
border: 1px solid #d9d9d9 !important;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/* 如果需要覆盖 Sender 组件内部的特定元素 */
|
|
212
|
-
.ant-sender .ant-input {
|
|
213
|
-
/* 输入框样式覆盖 */
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.ant-sender .ant-btn {
|
|
217
|
-
/* 按钮样式覆盖 */
|
|
218
|
-
}
|
|
219
|
-
`}
|
|
220
|
-
/>
|
|
221
|
-
);
|
|
222
|
-
```
|
|
97
|
+
| config | object | 是 | 配置信息,包含 appNo、pt、tc 等 |
|
|
98
|
+
| componentProps | object | 否 | 容器属性,支持 id 和任意 CSS 样式 |
|
|
99
|
+
| onError | function | 否 | 错误回调函数 |
|
|
100
|
+
| onSuccess | function | 否 | 成功回调函数 |
|
|
223
101
|
|
|
224
|
-
|
|
102
|
+
### 回调函数
|
|
225
103
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
104
|
+
#### onError(error)
|
|
105
|
+
- `error.code`: 错误代码
|
|
106
|
+
- `error.message`: 错误信息
|
|
229
107
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
# 构建
|
|
234
|
-
pnpm build
|
|
235
|
-
```
|
|
108
|
+
#### onSuccess(appInfo)
|
|
109
|
+
- `appInfo`: 应用信息对象,包含应用配置等
|
|
236
110
|
|
|
237
|
-
##
|
|
111
|
+
## 错误代码
|
|
238
112
|
|
|
239
|
-
|
|
113
|
+
| 代码 | 说明 |
|
|
114
|
+
|------|------|
|
|
115
|
+
| APP_NOT_ENABLE | 应用未启用 |
|
|
116
|
+
| APP_DELETED | 应用已下架 |
|
|
117
|
+
| APP_NOT_FOUND | 应用未找到 |
|
|
118
|
+
| API_ERROR | API 调用错误 |
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>编组 5备份</title>
|
|
4
|
+
<g id="自主规划智能体25.7" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="预览调试" transform="translate(-100, -109)" stroke="#3961F2">
|
|
6
|
+
<g id="编组" transform="translate(84, 96)">
|
|
7
|
+
<g id="编组-5备份" transform="translate(16, 13)">
|
|
8
|
+
<path d="M9.63770387,0.5 L13.5,4.3563963 L13.5,12 C13.5,12.4142136 13.3321068,12.7892136 13.0606602,13.0606602 C12.7892136,13.3321068 12.4142136,13.5 12,13.5 L2,13.5 C1.58578644,13.5 1.21078644,13.3321068 0.939339828,13.0606602 C0.667893219,12.7892136 0.5,12.4142136 0.5,12 L0.5,2 C0.5,1.58578644 0.667893219,1.21078644 0.939339828,0.939339828 C1.21078644,0.667893219 1.58578644,0.5 2,0.5 L9.63770387,0.5 Z" id="矩形"></path>
|
|
9
|
+
<line x1="3.5" y1="5.5" x2="7.5" y2="5.5" id="直线" stroke-linecap="round" stroke-linejoin="round"></line>
|
|
10
|
+
<path d="M9.59276104,1.42542483 L9.59276104,3.42542483 C9.59276104,3.97770958 10.0404763,4.42542483 10.592761,4.42542483 L13.0804805,4.42542483 L13.0804805,4.42542483" id="直线备份-2" stroke-linecap="square"></path>
|
|
11
|
+
<line x1="3.5" y1="8.5" x2="9.5" y2="8.5" id="直线备份" stroke-linecap="round" stroke-linejoin="round"></line>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BubbleDataType } from '@ant-design/x/es/bubble/BubbleList';
|
|
2
|
+
export interface AiClient {
|
|
3
|
+
appName: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
send(message: string): Promise<any>;
|
|
6
|
+
stream?(message: string, onMessage: (msg: any) => void): void;
|
|
7
|
+
close?(): void;
|
|
8
|
+
}
|
|
9
|
+
export type MessageType = BubbleDataType;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/client/base.ts
|
|
16
|
+
var base_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(base_exports);
|
|
18
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/client/base.ts"],
|
|
4
|
+
"sourcesContent": ["// baseClient.ts\nimport { BubbleDataType } from '@ant-design/x/es/bubble/BubbleList';\n\nexport interface AiClient {\n appName: string;\n icon: string;\n send(message: string): Promise<any>;\n stream?(message: string, onMessage: (msg: any) => void): void;\n close?(): void;\n}\n\nexport type MessageType = BubbleDataType;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=restClient.js.map
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=wsClient.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import XAiChatbot from '.';
|
|
3
|
+
declare const meta: Meta<typeof XAiChatbot>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const 基础用法: Story;
|
|
7
|
+
export declare const 在Provider中使用: Story;
|
|
8
|
+
export declare const 多个Provider实例: Story;
|
|
9
|
+
export declare const 新架构演示: Story;
|
|
10
|
+
export declare const 架构对比演示: Story;
|