@glodon-aiot/bot-client-ui 3.3.5-alpha.27 → 3.3.5-alpha.29

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