@glodon-aiot/bot-client-ui 3.3.7-beta.2 → 3.3.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 +36 -55
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
`yarn add @glodon-aiot/bot-client-ui`
|
|
10
10
|
|
|
11
|
-
## 从
|
|
12
|
-
|
|
13
|
-
一些项目无法处理 esm,请使用以下方式引入依赖。BotClientUI 将被注册在 window 对象上。
|
|
11
|
+
## 从cdn引入cjs文件
|
|
12
|
+
一些项目无法处理esm,请使用以下方式引入依赖。BotClientUI将被注册在window对象上。
|
|
14
13
|
`<script src="https://cv-cdn.obs.cn-north-4.myhuaweicloud.com/glodon/libs/bot-client-ui/3.3.0/bot-client-ui.umd.cjs"></script>`
|
|
15
14
|
|
|
16
15
|
# 快速开始
|
|
@@ -40,24 +39,25 @@ new BotClientUI({
|
|
|
40
39
|
|
|
41
40
|
## 通用配置
|
|
42
41
|
|
|
43
|
-
| 名称
|
|
44
|
-
|
|
|
45
|
-
| token
|
|
46
|
-
| apiUrl
|
|
47
|
-
| getContainer
|
|
48
|
-
| sessionId
|
|
49
|
-
| mode
|
|
50
|
-
| header
|
|
51
|
-
| footer
|
|
52
|
-
| sider
|
|
53
|
-
| icon
|
|
54
|
-
| size
|
|
55
|
-
| open
|
|
56
|
-
| triggerButton
|
|
57
|
-
| features
|
|
58
|
-
| debug
|
|
59
|
-
| eventListeners | [EventListeners](#IhvdK)
|
|
60
|
-
| errorHandlers
|
|
42
|
+
| 名称 | 类型 | 必填 | 默认值 | 说明 | 适用应用类型 | 支持版本 |
|
|
43
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
44
|
+
| token | string | 是 | - | aiot 行业AI平台的AI应用的resource token。详情查看[认证说明](https://glodon-cv-help.yuque.com/lzh2bp/eszzb5/evk1gvh3pqaexe74?singleDoc#%20《认证说明》)。 | 全部 | |
|
|
45
|
+
| apiUrl | string | 否 | `https://copilot.glodon.com/api/cvforce` | 拼接规则:``${origin}/api/cvforce``,其中`origin`是部署服务的源地址。 | 全部 | 3.0.8 |
|
|
46
|
+
| getContainer | () => Element | 否 | () => document.body | 容器元素获取方法,默认在document.body中渲染 | 全部 | |
|
|
47
|
+
| sessionId | string | 否 | - | 默认加载的会话ID | Agent/对话 | |
|
|
48
|
+
| mode | 'float' | 'inlay' | 否 | 'float' | 悬浮按钮模式,或者嵌入模式 | Agent/对话 | |
|
|
49
|
+
| header | Element | string | boolean | 否 | 应用名称 | 应用名称 | Agent/对话 | |
|
|
50
|
+
| footer | Element | string | boolean | 否 | | | Agent/对话 | |
|
|
51
|
+
| sider | boolean | 否 | | inlay模式可用。 是否展示左侧会话列表 | Agent/对话 | |
|
|
52
|
+
| icon | string | 否 | | 影响greeting和triggerButton的icon | Agent/对话 | 3.3.1 |
|
|
53
|
+
| size | [SizeConfig](#GbxmJ) | 否 | {width: 450} | float模式下:窗体大小 | 全部 | |
|
|
54
|
+
| open | boolean | 否 | false | float模式下:默认打开状态 | Agent/对话 | |
|
|
55
|
+
| triggerButton | [TriggerButtonConfig](#djhoc) | 否 | {visible: true} | triggerButton设置 | Agent/对话 | |
|
|
56
|
+
| features | [Features](#uIpxC) | 否 | FEATURE_DEFAULT | 功能配置 | Agent/对话 | |
|
|
57
|
+
| debug | boolean | 否 | false | 打开debug模式时:<br/>1. 控制log输出。 2. promptValues变为非必填项; 3. Agent类型应用下,控制ws连接是否开启,debug模式,由于收到权限限制,可能会配置失败。 | Agent/对话 | |
|
|
58
|
+
| eventListeners | [EventListeners](#IhvdK) | | | 事件监听器配置 | Agent/对话 | |
|
|
59
|
+
| errorHandlers | [ErrorHandlers](#VTONU) | 否 | - | errorHandlers.token 是token验证失败后的处理器; errorHandlers.promptValues 非debug模式下,检测空值 | 全部 | |
|
|
60
|
+
|
|
61
61
|
|
|
62
62
|
## 只适用于 Agent 应用的配置
|
|
63
63
|
|
|
@@ -151,14 +151,11 @@ interface Knowledge {
|
|
|
151
151
|
```typescript
|
|
152
152
|
interface Feature {
|
|
153
153
|
// 问候
|
|
154
|
-
greeting?:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
questions?: boolean; // 推荐问题
|
|
160
|
-
layoutBreakpoints?: number[]; // 布局断点数组
|
|
161
|
-
};
|
|
154
|
+
greeting?: boolean | {
|
|
155
|
+
icon?: string;
|
|
156
|
+
text?: string; // 问候语
|
|
157
|
+
questions?: boolean; // 推荐问题
|
|
158
|
+
};
|
|
162
159
|
// toolbar中的"会话历史记录"
|
|
163
160
|
sessionList?: boolean;
|
|
164
161
|
// toolbar中的"新会话"
|
|
@@ -197,23 +194,19 @@ interface Feature {
|
|
|
197
194
|
};
|
|
198
195
|
prompts?: boolean;
|
|
199
196
|
// toolbar中的网络访问
|
|
200
|
-
connectNetwork?:
|
|
201
|
-
| boolean
|
|
202
|
-
| { visible: boolean; default?: boolean; disabled?: boolean };
|
|
197
|
+
connectNetwork?: boolean | { visible: boolean; default?: boolean; disabled?: boolean };
|
|
203
198
|
// 参考知识库设置
|
|
204
|
-
knowledges?:
|
|
205
|
-
| boolean
|
|
206
|
-
| { visible: boolean; default: Knowledge[]; disabled?: boolean };
|
|
199
|
+
knowledges?: boolean | { visible: boolean; default: Knowledge[]; disabled?: boolean };
|
|
207
200
|
// 用户指令变量设置
|
|
208
201
|
promptVariables?: boolean | { visible: boolean; default: SessionPrompt[] };
|
|
209
202
|
// 支持自定义问答内容markdown的超链接元素的点击事件
|
|
210
203
|
markdown?: {
|
|
211
204
|
componentProps?: {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
205
|
+
a?: {
|
|
206
|
+
onClick?: (e: {nativeEvent: PointerEvent}) => void;
|
|
207
|
+
};
|
|
215
208
|
};
|
|
216
|
-
}
|
|
209
|
+
}
|
|
217
210
|
}
|
|
218
211
|
```
|
|
219
212
|
|
|
@@ -221,22 +214,14 @@ interface Feature {
|
|
|
221
214
|
|
|
222
215
|
```typescript
|
|
223
216
|
interface EventListeners {
|
|
224
|
-
comment: (payload: {
|
|
225
|
-
applicationId: string;
|
|
226
|
-
sessionId: string;
|
|
227
|
-
comment: Comment;
|
|
228
|
-
}) => void;
|
|
217
|
+
comment: (payload: { applicationId: string; sessionId: string; comment: Comment }) => void;
|
|
229
218
|
sessionload: (payload: {
|
|
230
219
|
applicationId: string;
|
|
231
220
|
sessionId: string;
|
|
232
221
|
session: SessionInfo;
|
|
233
222
|
sessionInstance: Session;
|
|
234
223
|
}) => void;
|
|
235
|
-
message: (payload: {
|
|
236
|
-
applicationId: string;
|
|
237
|
-
sessionId: string;
|
|
238
|
-
message: Message;
|
|
239
|
-
}) => void;
|
|
224
|
+
message: (payload: { applicationId: string; sessionId: string; message: Message }) => void;
|
|
240
225
|
beforemessagesend: (payload: {
|
|
241
226
|
applicationId: string;
|
|
242
227
|
sessionId: string;
|
|
@@ -303,9 +288,7 @@ interface McpConfig {
|
|
|
303
288
|
```javascript
|
|
304
289
|
window.pluginACode = {
|
|
305
290
|
functionCode1: (params, cb) => {
|
|
306
|
-
console.log(
|
|
307
|
-
`模拟pluginA function1 执行\n执行入参\n${JSON.stringify(arguments)}`
|
|
308
|
-
);
|
|
291
|
+
console.log(`模拟pluginA function1 执行\n执行入参\n${JSON.stringify(arguments)}`);
|
|
309
292
|
setTimeout(() => {
|
|
310
293
|
console.log(`模拟pluginA function1 执行完成`);
|
|
311
294
|
cb({
|
|
@@ -319,9 +302,7 @@ window.pluginACode = {
|
|
|
319
302
|
}, 5000);
|
|
320
303
|
},
|
|
321
304
|
functionCode2: (params, cb) => {
|
|
322
|
-
console.log(
|
|
323
|
-
`模拟pluginA function2 执行\n执行入参\n${JSON.stringify(arguments)}`
|
|
324
|
-
);
|
|
305
|
+
console.log(`模拟pluginA function2 执行\n执行入参\n${JSON.stringify(arguments)}`);
|
|
325
306
|
setTimeout(() => {
|
|
326
307
|
console.log(`模拟pluginA function2 执行完成`);
|
|
327
308
|
cb({
|