@blueking/ai-ui-sdk 0.4.1-beta.9 → 0.4.2

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.
Files changed (139) hide show
  1. package/README.md +2214 -246
  2. package/dist/common/util.d.ts +0 -5
  3. package/dist/common/util.ts.js +0 -8
  4. package/dist/components/render-agent/agent-type.vue.css +3 -3
  5. package/dist/components/render-agent/agent-type.vue.js +1 -1
  6. package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
  7. package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
  8. package/dist/components/render-auto-refresh/index.vue.css +8 -8
  9. package/dist/components/render-auto-refresh/index.vue.js +1 -1
  10. package/dist/components/render-card/agent/actions.script.vue.js.js +51 -28
  11. package/dist/components/render-card/agent/index.script.vue.js.js +7 -7
  12. package/dist/components/render-card/agent/prefix-info-tool.vue.css +5 -5
  13. package/dist/components/render-card/agent/prefix-info-tool.vue.js +1 -1
  14. package/dist/components/render-card/agent-command/index.script.vue.js.js +4 -4
  15. package/dist/components/render-card/agent-command/info-tool.script.vue.js.js +4 -3
  16. package/dist/components/render-card/base/application-base-actions.script.vue.js.js +36 -2
  17. package/dist/components/render-card/base/application-base-actions.vue.d.ts +12 -0
  18. package/dist/components/render-card/base.vue.css +12 -12
  19. package/dist/components/render-card/base.vue.d.ts +2 -2
  20. package/dist/components/render-card/base.vue.js +1 -1
  21. package/dist/components/render-card/knowledgebase/actions.script.vue.js.js +13 -5
  22. package/dist/components/render-card/knowledgebase/actions.vue.d.ts +3 -0
  23. package/dist/components/render-card/knowledgebase/index.script.vue.js.js +2 -1
  24. package/dist/components/render-card/knowledgebase/index.vue.d.ts +1 -1
  25. package/dist/components/render-card/llm/corner-badge.vue.css +3 -3
  26. package/dist/components/render-card/llm/corner-badge.vue.js +1 -1
  27. package/dist/components/render-card/llm/icons.vue.css +2 -2
  28. package/dist/components/render-card/llm/icons.vue.js +1 -1
  29. package/dist/components/render-card/llm/info.vue.css +1 -1
  30. package/dist/components/render-card/llm/info.vue.js +1 -1
  31. package/dist/components/render-card/llm/tag-prefix.vue.css +3 -3
  32. package/dist/components/render-card/llm/tag-prefix.vue.js +1 -1
  33. package/dist/components/render-card/mcp/actions.script.vue.js.js +29 -12
  34. package/dist/components/render-card/mcp/index.vue.d.ts +1 -1
  35. package/dist/components/render-card/mcp/name-suffix.vue.css +2 -2
  36. package/dist/components/render-card/mcp/name-suffix.vue.js +1 -1
  37. package/dist/components/render-card/prompt/icons.vue.css +1 -1
  38. package/dist/components/render-card/prompt/icons.vue.js +1 -1
  39. package/dist/components/render-card/prompt/index.vue.d.ts +1 -1
  40. package/dist/components/render-card/role/index.vue.d.ts +1 -1
  41. package/dist/components/render-card/skill/index.vue.d.ts +2 -2
  42. package/dist/components/render-card/skill/tag-prefix.vue.css +3 -3
  43. package/dist/components/render-card/skill/tag-prefix.vue.js +1 -1
  44. package/dist/components/render-card/tool/actions.script.vue.js.js +23 -3
  45. package/dist/components/render-card/tool/index.vue.d.ts +1 -1
  46. package/dist/components/render-checkbox/index.vue.css +9 -9
  47. package/dist/components/render-checkbox/index.vue.js +1 -1
  48. package/dist/components/render-choose-tag/index.script.vue.js.js +24 -70
  49. package/dist/components/render-choose-tag/index.vue.css +7 -7
  50. package/dist/components/render-choose-tag/index.vue.js +1 -1
  51. package/dist/components/render-collapse/index.vue.css +2 -2
  52. package/dist/components/render-collapse/index.vue.js +1 -1
  53. package/dist/components/render-collection/actions/index.script.vue.js.js +23 -3
  54. package/dist/components/render-collection/content/index.vue.css +4 -4
  55. package/dist/components/render-collection/content/index.vue.js +1 -1
  56. package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.css +3 -3
  57. package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.js +1 -1
  58. package/dist/components/render-dataset/components/batch-edit-valid-dataset-data/index.vue.css +1 -1
  59. package/dist/components/render-dataset/components/batch-edit-valid-dataset-data/index.vue.js +1 -1
  60. package/dist/components/render-dataset/components/dataset-data-tool-icons/index.script.vue.js +1 -1
  61. package/dist/components/render-dataset/components/dataset-data-valid/index.vue.css +1 -1
  62. package/dist/components/render-dataset/components/dataset-data-valid/index.vue.js +1 -1
  63. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
  64. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
  65. package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
  66. package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
  67. package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
  68. package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
  69. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
  70. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
  71. package/dist/components/render-dataset/components/plus-dataset/index.vue.css +1 -1
  72. package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
  73. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.css +2 -2
  74. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.js +1 -1
  75. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
  76. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
  77. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +1 -1
  78. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
  79. package/dist/components/render-dataset/components/review-dataset-data/index.vue.css +10 -10
  80. package/dist/components/render-dataset/components/review-dataset-data/index.vue.js +1 -1
  81. package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
  82. package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
  83. package/dist/components/render-dataset-list/components/main.vue.css +3 -3
  84. package/dist/components/render-dataset-list/components/main.vue.js +1 -1
  85. package/dist/components/render-dataset-list/index.vue.css +2 -2
  86. package/dist/components/render-dataset-list/index.vue.js +1 -1
  87. package/dist/components/render-dialog/choose-resource.vue.css +3 -3
  88. package/dist/components/render-dialog/choose-resource.vue.js +1 -1
  89. package/dist/components/render-dialog/choose-result.vue.css +14 -14
  90. package/dist/components/render-dialog/choose-result.vue.js +1 -1
  91. package/dist/components/render-dialog/choose-space.vue.css +9 -9
  92. package/dist/components/render-dialog/choose-space.vue.js +1 -1
  93. package/dist/components/render-dialog/index.vue.css +6 -6
  94. package/dist/components/render-dialog/index.vue.js +1 -1
  95. package/dist/components/render-dropdown/index.script.vue.js.js +4 -0
  96. package/dist/components/render-dropdown/index.vue.d.ts +2 -0
  97. package/dist/components/render-file-card/index.vue.css +11 -11
  98. package/dist/components/render-file-card/index.vue.js +1 -1
  99. package/dist/components/render-file-type-icon/index.vue.css +6 -6
  100. package/dist/components/render-file-type-icon/index.vue.js +1 -1
  101. package/dist/components/render-generate-tag/index.vue.css +5 -5
  102. package/dist/components/render-generate-tag/index.vue.js +1 -1
  103. package/dist/components/render-knowledge/icon/index.vue.css +1 -1
  104. package/dist/components/render-knowledge/icon/index.vue.js +1 -1
  105. package/dist/components/render-knowledge/search/index.script.vue.js.js +5 -1
  106. package/dist/components/render-prompt/actions/index.script.vue.js.js +22 -2
  107. package/dist/components/render-prompt/content/index.vue.css +1 -1
  108. package/dist/components/render-prompt/content/index.vue.js +1 -1
  109. package/dist/components/render-reference/index.vue.css +2 -2
  110. package/dist/components/render-reference/index.vue.js +1 -1
  111. package/dist/components/render-relate-agent/index.script.vue.js +11 -4
  112. package/dist/components/render-relate-agent/index.vue.d.ts +2 -0
  113. package/dist/components/render-resource-version/index.vue.css +2 -2
  114. package/dist/components/render-resource-version/index.vue.js +1 -1
  115. package/dist/components/render-router-tab/index.vue.css +3 -3
  116. package/dist/components/render-router-tab/index.vue.js +1 -1
  117. package/dist/components/render-select-plus-extension/index.vue.css +3 -3
  118. package/dist/components/render-select-plus-extension/index.vue.js +1 -1
  119. package/dist/components/render-skill/actions/index.script.vue.js.js +44 -6
  120. package/dist/components/render-skill/variable-form/index.script.vue.js +3 -5
  121. package/dist/components/render-t-table/index.script.vue.js +4 -3
  122. package/dist/components/render-t-table/index.vue.css +27 -27
  123. package/dist/components/render-t-table/index.vue.js +1 -1
  124. package/dist/components/render-tag-tree/index.vue.css +7 -7
  125. package/dist/components/render-tag-tree/index.vue.js +1 -1
  126. package/dist/components/render-tags/index.vue.css +6 -6
  127. package/dist/components/render-tags/index.vue.js +1 -1
  128. package/dist/css/g-utilities.css +9 -4
  129. package/dist/css/g-utilities.manifest.json +1 -1
  130. package/dist/hooks/use-dataset-http.d.ts +1 -2
  131. package/dist/hooks/use-dataset-http.ts.js +1 -1
  132. package/dist/hooks/use-form-leave-confirm.d.ts +1 -1
  133. package/dist/hooks/use-form-leave-confirm.ts.js +34 -5
  134. package/dist/hooks/use-meta-http.d.ts +1 -2
  135. package/dist/hooks/use-meta-http.ts.js +1 -1
  136. package/dist/hooks/use-permission.ts.js +2 -0
  137. package/dist/types/enum.d.ts +1 -0
  138. package/dist/types/enum.ts.js +1 -0
  139. package/package.json +1 -1
package/README.md CHANGED
@@ -1,290 +1,2258 @@
1
1
  # @blueking/ai-ui-sdk
2
2
 
3
- 蓝鲸 AI UI SDK 是一个用于快速构建 AI 聊天界面的 Vue 3 组件库。该 SDK 提供了一系列易用的 Hooks 和工具,帮助开发者轻松集成 AI 对话、内容总结、样式管理等功能。
3
+ 蓝鲸 AI UI SDKVue 3),提供资源卡片、搜索栏、数据集、Markdown、表格等业务组件,以及 Hooks、HTTP、类型与工具方法。
4
+
5
+ 当前版本:`0.4.1-beta.18`
4
6
 
5
7
  ## 安装
6
8
 
7
- ```bash
8
- npm install @blueking/ai-ui-sdk
9
- # 或
10
- yarn add @blueking/ai-ui-sdk
11
- ```
9
+ ```bash
10
+ npm install @blueking/ai-ui-sdk
11
+ # 或
12
+ yarn add @blueking/ai-ui-sdk
13
+ ```
14
+
15
+ ### Peer Dependencies
16
+
17
+ 请确保宿主项目已安装(版本参考 `package.json`):
18
+
19
+ - `vue` ^3.5
20
+ - `vue-router` ^4
21
+ - `bkui-vue`
22
+ - `tdesign-vue-next`
23
+ - `@toast-ui/editor`、`@toast-ui/editor-plugin-code-syntax-highlight`
24
+ - `@blueking/ediatable`、`@blueking/xss-filter`
25
+ - `dayjs`、`katex`、`prismjs`、`tippy.js`
26
+
27
+ ## 子路径导出
28
+
29
+ 本包通过子路径导出,**无根路径默认入口**,请按需引入:
30
+
31
+ | 子路径 | 说明 |
32
+ |--------|------|
33
+ | `@blueking/ai-ui-sdk/components` | 公开组件 + `renderAuthDialog` |
34
+ | `@blueking/ai-ui-sdk/hooks` | 通用 Hooks |
35
+ | `@blueking/ai-ui-sdk/https` | 资源 HTTP Hooks |
36
+ | `@blueking/ai-ui-sdk/types` | TypeScript 类型 |
37
+ | `@blueking/ai-ui-sdk/enums` | 枚举 |
38
+ | `@blueking/ai-ui-sdk/events` | 全局事件总线 |
39
+ | `@blueking/ai-ui-sdk/constants` | 常量 |
40
+ | `@blueking/ai-ui-sdk/util` | 工具函数 |
41
+ | `@blueking/ai-ui-sdk/transforms` | API ↔ 前端模型转换 |
42
+ | `@blueking/ai-ui-sdk/style` | 样式 CSS |
43
+ | `@blueking/ai-ui-sdk/g-utilities-manifest` | g-utilities manifest |
44
+
45
+ ```ts
46
+ import { RenderAgentCard, RenderHeader } from '@blueking/ai-ui-sdk/components';
47
+ import { useStyle, useClickProxy } from '@blueking/ai-ui-sdk/hooks';
48
+ import { useAgentHttp } from '@blueking/ai-ui-sdk/https';
49
+ import { ResourceCardType, Module } from '@blueking/ai-ui-sdk/enums';
50
+ ```
51
+
52
+ ## 快速开始
53
+
54
+ ```ts
55
+ import { useStyle, useClickProxy } from '@blueking/ai-ui-sdk/hooks';
56
+
57
+ // 应用入口调用一次,注入 SDK 全局样式
58
+ useStyle();
59
+
60
+ // 如需代码块折叠 / 全屏 / 复制 / 下载等点击代理
61
+ useClickProxy();
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 组件 API
67
+
68
+ 以下组件均从 `@blueking/ai-ui-sdk/components` 引入。每个组件均按以下四块说明,**各自单独成段**:
69
+
70
+ - **Props**:属性表;无则写「无」
71
+ - **Events**:事件表;无则写「无」
72
+ - **Expose**:方法表;无则写「无」
73
+ - **Slots**:插槽表;无则写「无」
74
+
75
+ > 约定:`required`(✓)表示必传;其余为可选。类型名来自 `@blueking/ai-ui-sdk/types` / `enums`。
76
+
77
+ ### 目录
78
+
79
+ - [基础 UI](#基础-ui)
80
+ - [Agent](#agent)
81
+ - [资源卡片](#资源卡片)
82
+ - [搜索栏](#搜索栏)
83
+ - [操作与内容](#操作与内容)
84
+ - [数据集](#数据集)
85
+ - [弹窗与关联](#弹窗与关联)
86
+ - [Markdown](#markdown)
87
+ - [命令式 API](#命令式-api)
88
+
89
+ ---
90
+
91
+ ### 基础 UI
92
+
93
+ #### RenderAutoHeightTextarea
94
+
95
+ 自适应高度文本域。
96
+
97
+ **Props**
98
+
99
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
100
+ |------|------|------|--------|------|
101
+ | modelValue | `string` | | | 绑定值 |
102
+ | placeholder | `string` | | | 占位文案 |
103
+ | height | `number` | ✓ | | 初始高度 |
104
+ | maxHeight | `number` | | `400` | 最大高度 |
105
+ | focusShowHeight | `boolean` | | `false` | 聚焦时展开高度 |
106
+ | disabled | `boolean` | | | 禁用 |
107
+
108
+ **Events**
109
+
110
+ | 事件 | 参数 | 说明 |
111
+ |------|------|------|
112
+ | update:modelValue | `(val: string)` | v-model |
113
+ | input | `(val: string, event?: KeyboardEvent)` | 输入 |
114
+
115
+ **Expose**
116
+
117
+
118
+
119
+ **Slots**
120
+
121
+
122
+
123
+ ---
124
+
125
+ #### RenderAutoRefresh
126
+
127
+ 自动刷新间隔选择。
128
+
129
+ **Props**
130
+
131
+
132
+
133
+ **Events**
134
+
135
+ | 事件 | 参数 | 说明 |
136
+ |------|------|------|
137
+ | update | `()` | 触发刷新(含定时) |
138
+
139
+ **Expose**
140
+
141
+
142
+
143
+ **Slots**
144
+
145
+
146
+
147
+ ---
148
+
149
+ #### RenderCheckbox
150
+
151
+ 自定义复选框。
152
+
153
+ **Props**
154
+
155
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
156
+ |------|------|------|--------|------|
157
+ | checked | `boolean` | ✓ | | 是否选中 |
158
+ | indeterminate | `boolean` | | | 半选 |
159
+ | disabled | `boolean` | | | 禁用 |
160
+ | title | `string` | | | 标题 |
161
+ | suffixTitle | `string` | | | 后缀标题 |
162
+
163
+ **Events**
164
+
165
+ | 事件 | 参数 |
166
+ |------|------|
167
+ | change | `(checked: boolean)` |
168
+ | update:checked | `(checked: boolean)` |
169
+
170
+ **Expose**
171
+
172
+
173
+
174
+ **Slots**
175
+
176
+
177
+
178
+ ---
179
+
180
+ #### RenderChooseTag
181
+
182
+ 标签选择器。
183
+
184
+ **Props**
185
+
186
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
187
+ |------|------|------|--------|------|
188
+ | modelValue | `string[][]` | ✓ | | 已选标签 |
189
+ | apiPrefix | `string` | ✓ | | API 前缀 |
190
+ | module | `Module` | ✓ | | 所属模块 |
191
+ | multiple | `boolean` | | | 多选 |
192
+ | spaceId | `string` | | | 空间 ID |
193
+ | isDataset | `boolean` | | | 数据集场景 |
194
+ | isEnabledCreateTag | `boolean` | | | 允许新建标签 |
195
+ | disabled | `boolean` | | | 禁用 |
196
+ | popoverOptions | `Record<string, unknown>` | | | Popover 配置 |
197
+
198
+ **Events**
199
+
200
+ | 事件 | 参数 |
201
+ |------|------|
202
+ | update:modelValue | `(value: string[][])` |
203
+
204
+ **Expose**
205
+
206
+
207
+
208
+ **Slots**
209
+
210
+
211
+
212
+ ---
213
+
214
+ #### RenderDropdown
215
+
216
+ 基于 Tippy 的下拉容器。
217
+
218
+ **Props**
219
+
220
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
221
+ |------|------|------|--------|------|
222
+ | placement | `Placement` | | `'bottom-start'` | 弹出位置 |
223
+ | arrow | `boolean` | | `false` | 箭头 |
224
+ | theme | `'light' \| 'light-border' \| 'material' \| 'translucent'` | | `'light'` | 主题 |
225
+ | animation | `'fade' \| 'shift-away' \| 'shift-toward' \| 'scale' \| 'perspective'` | | `'shift-away'` | 动画 |
226
+ | delay | `number \| [number \| null, number \| null]` | | `[0, 100]` | 延迟 |
227
+ | maxWidth | `number \| string` | | `'none'` | 最大宽度 |
228
+ | disabled | `boolean` | | `false` | 禁用 |
229
+ | beforeHide | `(instance: Instance) => boolean` | | | 隐藏前钩子 |
230
+ | tippyOptions | `Partial<Props>` | | | Tippy 透传配置 |
231
+
232
+ **Events**
233
+
234
+ | 事件 | 参数 |
235
+ |------|------|
236
+ | show / hide / mount / shown / hidden | `(instance: Instance)` |
237
+
238
+ **Expose**
239
+
240
+ | 方法 | 说明 |
241
+ |------|------|
242
+ | show() | 显示下拉 |
243
+ | hide() | 隐藏下拉 |
244
+
245
+ **Slots**
246
+
247
+ | 插槽 | 参数 | 说明 |
248
+ |------|------|------|
249
+ | trigger | — | 触发器 |
250
+ | content | — | 下拉内容 |
251
+
252
+ ---
253
+
254
+ #### RenderFileTypeIcon
255
+
256
+ 文件类型图标。
257
+
258
+ **Props**
259
+
260
+ | 属性 | 类型 | 必填 | 说明 |
261
+ |------|------|------|------|
262
+ | type | `string` | ✓ | 文件类型 |
263
+
264
+ **Events**
265
+
266
+
267
+
268
+ **Expose**
269
+
270
+
271
+
272
+ **Slots**
273
+
274
+
275
+
276
+ ---
277
+
278
+ #### RenderGenerateTag
279
+
280
+ 资源生成类型标签。
281
+
282
+ **Props**
283
+
284
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
285
+ |------|------|------|--------|------|
286
+ | generateType | `EnumCharacter` | | | 生成类型 |
287
+ | module | `Module` | | | 模块 |
288
+ | isPublic | `boolean` | | | 是否公开 |
289
+ | showTips | `boolean` | | `true` | 展示提示 |
290
+ | spaceId | `string` | | | 空间 ID |
291
+ | spaces | `ISpace[]` | | | 空间列表 |
292
+ | height | `number \| string` | | `16` | 高度 |
293
+ | fontSize | `number \| string` | | `12` | 字号 |
294
+ | padding | `number \| string` | | `2` | 内边距 |
295
+
296
+ **Events**
297
+
298
+
299
+
300
+ **Expose**
301
+
302
+
303
+
304
+ **Slots**
305
+
306
+
307
+
308
+ ---
309
+
310
+ #### RenderHeader
311
+
312
+ 资源页头部(标题 / 分组 Tab)。
313
+
314
+ **Props**
315
+
316
+ | 属性 | 类型 | 必填 | 说明 |
317
+ |------|------|------|------|
318
+ | title | `string` | | 标题 |
319
+ | groupType | `GroupType` | | 当前分组 |
320
+ | loading | `boolean` | | 加载中 |
321
+ | tabs | `{ id: GroupType; name: string; number: number; tooltip?: string }[]` | | Tab 列表 |
322
+
323
+ **Events**
324
+
325
+ | 事件 | 参数 |
326
+ |------|------|
327
+ | update:groupType | `(val: GroupType)` |
328
+
329
+ **Expose**
330
+
331
+
332
+
333
+ **Slots**
334
+
335
+ | 插槽 | 参数 | 说明 |
336
+ |------|------|------|
337
+ | title | — | 自定义标题 |
338
+ | title-right | — | 标题右侧 |
339
+ | action-right | — | 操作区右侧 |
340
+
341
+ ---
342
+
343
+ #### RenderImage
344
+
345
+ 带默认图回退的图片。
346
+
347
+ **Props**
348
+
349
+ | 属性 | 类型 | 必填 | 说明 |
350
+ |------|------|------|------|
351
+ | url | `string` | ✓ | 图片地址 |
352
+ | size | `number` | ✓ | 尺寸 |
353
+ | defaultUrl | `string` | | 失败回退图 |
354
+
355
+ **Events**
356
+
357
+
358
+
359
+ **Expose**
360
+
361
+
362
+
363
+ **Slots**
364
+
365
+
366
+
367
+ ---
368
+
369
+ #### RenderSearchEmpty
370
+
371
+ 空态 / 无搜索结果。
372
+
373
+ **Props**
374
+
375
+ | 属性 | 类型 | 必填 | 说明 |
376
+ |------|------|------|------|
377
+ | search | `T` | | 当前搜索条件 |
378
+ | scene | `'page' \| 'part'` | | 展示场景 |
379
+ | description | `string` | | 描述文案 |
380
+
381
+ **Events**
382
+
383
+ | 事件 | 参数 |
384
+ |------|------|
385
+ | update:search | `(data: T)` |
386
+
387
+ **Expose**
388
+
389
+
390
+
391
+ **Slots**
392
+
393
+
394
+
395
+ ---
396
+
397
+ #### RenderSearchSelect
398
+
399
+ 增强搜索选择。
400
+
401
+ **Props**
402
+
403
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
404
+ |------|------|------|--------|------|
405
+ | data | `ISearchSelectItem[]` | ✓ | | 筛选项配置 |
406
+ | modelValue | `T` | ✓ | | 绑定值 |
407
+ | placeholder | `string` | | | 占位 |
408
+ | validateValues | `ValidateValue` | | | 校验 |
409
+ | getMenuList | `Function` | | | 菜单列表 |
410
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
411
+ | apiPrefix | `string` | | | API 前缀 |
412
+ | spaceId | `string` | | | 空间 ID |
413
+ | module | `Module` | | | 模块 |
414
+ | fuzzyKey | `string` | | `'fuzzy'` | 模糊搜索字段名 |
415
+ | isFuzzyEnabled | `boolean` | | `true` | 是否启用模糊搜索 |
416
+
417
+ **Events**
418
+
419
+ | 事件 | 参数 |
420
+ |------|------|
421
+ | update:modelValue | `(value: T)` |
422
+
423
+ **Expose**
424
+
425
+
426
+
427
+ **Slots**
428
+
429
+
430
+
431
+ ---
432
+
433
+ #### RenderSelectPlusExtension
434
+
435
+ Select 扩展「去新建」。
436
+
437
+ **Props**
438
+
439
+ | 属性 | 类型 | 必填 | 默认值 |
440
+ |------|------|------|--------|
441
+ | text | `string` | | `'去新建'` |
442
+ | icon | `string` | | |
443
+
444
+ **Events**
445
+
446
+
447
+
448
+ **Expose**
449
+
450
+
451
+
452
+ **Slots**
453
+
454
+
455
+
456
+ ---
457
+
458
+ #### RenderTags
459
+
460
+ 多行标签溢出展示。
461
+
462
+ **Props**
463
+
464
+ | 属性 | 类型 | 必填 | 默认值 |
465
+ |------|------|------|--------|
466
+ | tagNames | `string[][]` | ✓ | |
467
+ | height | `number \| string` | | `16` |
468
+ | fontSize | `number \| string` | | `10` |
469
+ | padding | `number \| string` | | `4` |
470
+
471
+ **Events**
472
+
473
+
474
+
475
+ **Expose**
476
+
477
+
478
+
479
+ **Slots**
480
+
481
+
482
+
483
+ ---
484
+
485
+ #### RenderResourceVersion
486
+
487
+ 资源版本标签。
488
+
489
+ **Props**
490
+
491
+ | 属性 | 类型 | 必填 | 默认值 |
492
+ |------|------|------|--------|
493
+ | version | `string` | | |
494
+ | height | `number \| string` | | `16` |
495
+ | fontSize | `number \| string` | | `10` |
496
+ | padding | `number \| string` | | `4` |
497
+
498
+ **Events**
499
+
500
+
501
+
502
+ **Expose**
503
+
504
+
505
+
506
+ **Slots**
507
+
508
+
509
+
510
+ ---
511
+
512
+ #### RenderResourceInfo
513
+
514
+ 资源元信息展示。
515
+
516
+ **Props**
517
+
518
+ | 属性 | 类型 | 必填 | 说明 |
519
+ |------|------|------|------|
520
+ | type | `ResourceCardType` | ✓ | 卡片类型 |
521
+ | updatedBy | `string` | ✓ | 更新人 |
522
+ | updatedAt | `string` | ✓ | 更新时间 |
523
+ | code | `string` | | 编码 |
524
+ | id | `number` | | ID |
525
+ | spaceId | `string` | | 空间 ID |
526
+ | appliedBy | `string` | | 申请人 |
527
+ | appliedAt | `string` | | 申请时间 |
528
+ | spaces | `ISpace[]` | | 空间列表 |
529
+ | version | `string` | | 版本 |
530
+
531
+ **Events**
532
+
533
+
534
+
535
+ **Expose**
536
+
537
+
538
+
539
+ **Slots**
540
+
541
+
542
+
543
+ ---
544
+
545
+ #### RenderTTable
546
+
547
+ TDesign 增强表格封装。
548
+
549
+ **Props**
550
+
551
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
552
+ |------|------|------|--------|------|
553
+ | columns | `ITTableCol<T>[]` | ✓ | | 列配置 |
554
+ | tableData | `T[]` | ✓ | | 表格数据 |
555
+ | rowKey | `string` | ✓ | | 行唯一键 |
556
+ | isLoading | `boolean` | | | 加载中 |
557
+ | pagination | `IPagination` | | | 分页 |
558
+ | layout | `string[]` | | 有分页时为 `['total','limit','list']` | 分页布局 |
559
+ | containerHeight | `string` | | | 容器高度 |
560
+ | search | `S` | | | 搜索条件 |
561
+ | rowClassName | `string \| string[] \| Record \| ((row, index) => ...)` | | | 行 class |
562
+ | height | `string` | | | 表格高度 |
563
+ | paginationBorder | `boolean` | | | 分页边框 |
564
+
565
+ **Events**
566
+
567
+ | 事件 | 参数 |
568
+ |------|------|
569
+ | sort-change | `(config, val)` |
570
+ | page-change | `(val: number)` |
571
+ | page-size-change | `(val: number)` |
572
+ | select-change | `(keys, selectedRowData: T[])` |
573
+ | row-click / row-mouseenter | `(row: T)` |
574
+ | row-mouseleave | `()` |
575
+ | update:search | `(search: S)` |
576
+
577
+ **Expose**
578
+
579
+
580
+
581
+ **Slots**
582
+
583
+ | 插槽 | 参数 | 说明 |
584
+ |------|------|------|
585
+ | expandedRow | `{ row: T }` | 展开行内容 |
586
+
587
+ ---
588
+
589
+ #### RenderTagTree
590
+
591
+ 资源标签树。
592
+
593
+ **Props**
594
+
595
+ | 属性 | 类型 | 必填 | 说明 |
596
+ |------|------|------|------|
597
+ | module | `Module` | ✓ | 模块 |
598
+ | subModule | `Module` | ✓ | 子模块 |
599
+ | tagName | `string` | ✓ | 标签名 |
600
+ | apiPrefix | `string` | ✓ | API 前缀 |
601
+ | tagId | `number` | | 标签 ID |
602
+ | groupType | `GroupType` | | 分组 |
603
+ | generateType | `EnumCharacter` | | 生成类型 |
604
+ | spaceId | `string` | | 空间 ID |
605
+
606
+ **Events**
607
+
608
+ | 事件 | 参数 |
609
+ |------|------|
610
+ | update:tag-id | `(tagId: number)` |
611
+ | update:tagName | `(tagName: string)` |
612
+
613
+ **Expose**
614
+
615
+ | 方法 | 说明 |
616
+ |------|------|
617
+ | handleGetTagsTree() | 重新拉取标签树 |
618
+
619
+ **Slots**
620
+
621
+
622
+
623
+ ---
624
+
625
+ #### RenderTree
626
+
627
+ 通用异步树。
628
+
629
+ **Props**
630
+
631
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
632
+ |------|------|------|--------|------|
633
+ | data | `T[]` | ✓ | | 树数据 |
634
+ | apiPrefix | `string` | ✓ | | API 前缀 |
635
+ | keyName | `keyof T` | ✓ | | 节点主键字段 |
636
+ | search | `S` | | | 搜索条件 |
637
+ | spaceId | `string` | | | 空间 ID |
638
+ | selectedId | `string \| number` | | | 选中节点 |
639
+ | loadingIds | `(string \| number)[]` | | | 加载中节点 |
640
+ | openedIds | `(string \| number)[]` | | | 展开节点 |
641
+ | permissionActionIds | `(string \| number)[]` | | | 权限相关 ID |
642
+ | chooseCheck | `(data: T) => Promise<boolean>` | | `() => Promise.resolve(true)` | 选中前校验 |
643
+ | isNodeHasChildren | `(data: T) => boolean` | | | 是否有子节点 |
644
+ | isNodeHasPermission | `(data: T) => boolean` | | `() => true` | 是否有权限 |
645
+
646
+ **Events**
647
+
648
+ | 事件 | 参数 |
649
+ |------|------|
650
+ | update:selectedId | `(value: string \| number)` |
651
+ | update:loadingIds / update:openedIds | `(value: (string \| number)[])` |
652
+ | select / async-load | `(node: T)` |
653
+ | update:search | `(value: S)` |
654
+
655
+ **Expose**
656
+
657
+
658
+
659
+ **Slots**
660
+
661
+ | 插槽 | 参数 | 说明 |
662
+ |------|------|------|
663
+ | default | `(data: T)` | 节点内容 |
664
+
665
+ ---
666
+
667
+ ### Agent
668
+
669
+ #### RenderAgentDownload
670
+
671
+ 智能体下载按钮。
672
+
673
+ **Props**
674
+
675
+ | 属性 | 类型 | 必填 | 说明 |
676
+ |------|------|------|------|
677
+ | apiPrefix | `string` | ✓ | API 前缀 |
678
+ | agent | `IAgent` | | 智能体 |
679
+ | spaceId | `string` | | 空间 ID |
680
+ | disabled | `boolean` | | 禁用 |
681
+ | disabledText | `string` | | 禁用提示 |
682
+ | needSaveBeforeDownload | `boolean` | | 下载前需保存 |
683
+ | text | `boolean` | | 是否展示文字 |
684
+ | size | `'' \| 'small'` | | 尺寸 |
685
+ | validate | `() => Promise<unknown>` | | 下载前校验 |
686
+
687
+ **Events**
688
+
689
+
690
+
691
+ **Expose**
692
+
693
+
694
+
695
+ **Slots**
696
+
697
+
698
+
699
+ ---
700
+
701
+ #### RenderAgentSearch
702
+
703
+ 智能体列表搜索栏。
704
+
705
+ **Props**
706
+
707
+ | 属性 | 类型 | 必填 | 说明 |
708
+ |------|------|------|------|
709
+ | search | `IAgentListParam` | ✓ | 搜索条件 |
710
+ | apiPrefix | `string` | ✓ | API 前缀 |
711
+ | memberUrl | `string` | ✓ | 成员搜索 URL |
712
+ | isShowAllSearchOptions | `boolean` | | 展示全部筛选项 |
713
+ | isShowTagSearch | `boolean` | | 展示标签搜索 |
714
+ | spaceId | `string` | | 空间 ID |
715
+ | module | `Module` | | 模块 |
716
+
717
+ **Events**
718
+
719
+ | 事件 | 参数 |
720
+ |------|------|
721
+ | update:search | `(search: IAgentListParam)` |
722
+
723
+ **Expose**
724
+
725
+
726
+
727
+ **Slots**
728
+
729
+
730
+
731
+ ---
732
+
733
+ #### RenderAgentShare
734
+
735
+ 智能体分享入口。
736
+
737
+ **Props**
738
+
739
+ | 属性 | 类型 | 必填 | 说明 |
740
+ |------|------|------|------|
741
+ | agent | `IAgent` | ✓ | 智能体 |
742
+ | apiPrefix | `string` | ✓ | API 前缀 |
743
+ | showIcon | `boolean` | | 展示图标 |
744
+ | spaceId | `string` | | 空间 ID |
745
+
746
+ **Events**
747
+
748
+
749
+
750
+ **Expose**
751
+
752
+
753
+
754
+ **Slots**
755
+
756
+
757
+
758
+ ---
759
+
760
+ #### RenderAgentType
761
+
762
+ 智能体类型标签(单智能体 / 流程)。
763
+
764
+ **Props**
765
+
766
+ | 属性 | 类型 | 必填 | 默认值 |
767
+ |------|------|------|--------|
768
+ | type | `AgentType` | ✓ | |
769
+ | height | `number \| string` | | `16` |
770
+ | fontSize | `number \| string` | | `10` |
771
+ | padding | `number \| string` | | `4` |
772
+
773
+ **Events**
774
+
775
+
776
+
777
+ **Expose**
778
+
779
+
780
+
781
+ **Slots**
782
+
783
+
784
+
785
+ ---
786
+
787
+ ### 资源卡片
788
+
789
+ 以下卡片组件各自列出完整 Props,不再用「共性」省略。
790
+
791
+ #### RenderAgentCard
792
+
793
+ 智能体资源卡片。
794
+
795
+ **Props**
796
+
797
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
798
+ |------|------|------|--------|------|
799
+ | agent | `T extends IAgent \| IApplicationAgent` | ✓ | | 智能体数据 |
800
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
801
+ | commands | `IAgentCommand[]` | | | 指令列表 |
802
+ | originAgentId | `number` | | | 来源智能体 ID |
803
+ | checked | `boolean` | | | 是否选中 |
804
+ | multiple | `boolean` | | | 是否多选 |
805
+ | disabled | `boolean` | | | 是否禁用 |
806
+ | isShowOperation | `boolean` | | | 是否展示操作 |
807
+ | groupType | `GroupType` | | | 分组类型 |
808
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
809
+ | spaceId | `string` | | | 空间 ID |
810
+ | spaces | `ISpace[]` | | | 空间列表 |
811
+ | apiPrefix | `string` | ✓ | | API 前缀 |
812
+ | defaultIcon | `string` | | | 默认图标 |
813
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
814
+
815
+ **Events**
816
+
817
+ | 事件 | 参数 | 说明 |
818
+ |------|------|------|
819
+ | delete | `(agent: T)` | 删除 |
820
+ | choose | `(agent: T)` | 选择 |
821
+ | edit | `(agent: T)` | 编辑 |
822
+ | success-delete | `()` | 删除成功 |
823
+ | success-restore | `()` | 恢复成功 |
824
+ | update:commands | `(commands: IAgentCommand[])` | 指令更新 |
825
+ | navigate | `(route: ISdkNavigateAction)` | 导航 |
826
+
827
+ **Expose**
828
+
829
+
830
+
831
+ **Slots**
832
+
833
+ | 插槽 | 参数 | 说明 |
834
+ |------|------|------|
835
+ | pre-actions | — | 操作区前置内容 |
836
+
837
+ ---
838
+
839
+ #### RenderAgentCommandCard
840
+
841
+ 智能体指令卡片。
842
+
843
+ **Props**
844
+
845
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
846
+ |------|------|------|--------|------|
847
+ | command | `IAgentCommand` | ✓ | | 指令 |
848
+ | agent | `IAgent` | ✓ | | 所属智能体 |
849
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
850
+ | disabled | `boolean` | | | 是否禁用 |
851
+ | checked | `boolean` | | | 是否选中 |
852
+ | isShowOperation | `boolean` | | | 是否展示操作 |
853
+ | spaces | `ISpace[]` | | | 空间列表 |
854
+ | defaultIcon | `string` | | | 默认图标 |
855
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
856
+
857
+ **Events**
858
+
859
+ | 事件 | 参数 | 说明 |
860
+ |------|------|------|
861
+ | choose | `(command: IAgentCommand)` | 选择 |
862
+ | delete | `(command: IAgentCommand)` | 删除 |
863
+ | edit | `(command: IAgentCommand)` | 编辑 |
864
+ | edit-alias | `(command: IAgentCommand)` | 编辑别名 |
865
+
866
+ **Expose**
867
+
868
+
869
+
870
+ **Slots**
871
+
872
+ | 插槽 | 参数 | 说明 |
873
+ |------|------|------|
874
+ | pre-actions | — | 操作区前置内容 |
875
+
876
+ ---
877
+
878
+ #### RenderKnowledgeCard
879
+
880
+ 知识资源卡片。
881
+
882
+ **Props**
883
+
884
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
885
+ |------|------|------|--------|------|
886
+ | knowledge | `T extends IKnowledge` | ✓ | | 知识数据 |
887
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
888
+ | commands | `IAgentCommand[]` | | | 指令列表 |
889
+ | originAgentId | `number` | | | 来源智能体 ID |
890
+ | disabled | `boolean` | | | 是否禁用 |
891
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
892
+ | checked | `boolean` | | | 是否选中 |
893
+ | multiple | `boolean` | | | 是否多选 |
894
+ | isShowOperation | `boolean` | | | 是否展示操作 |
895
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
896
+ | spaces | `ISpace[]` | | | 空间列表 |
897
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
898
+
899
+ **Events**
900
+
901
+ | 事件 | 参数 | 说明 |
902
+ |------|------|------|
903
+ | choose | `(knowledge: T)` | 选择 |
904
+ | delete | `(knowledge: T)` | 删除 |
905
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
906
+
907
+ **Expose**
908
+
909
+
910
+
911
+ **Slots**
912
+
913
+ | 插槽 | 参数 | 说明 |
914
+ |------|------|------|
915
+ | pre-actions | — | 操作区前置内容 |
916
+
917
+ ---
918
+
919
+ #### RenderKnowledgebaseCard
920
+
921
+ 知识库卡片。
922
+
923
+ **Props**
924
+
925
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
926
+ |------|------|------|--------|------|
927
+ | knowledgebase | `T extends IKnowledgebase \| IApplicationKnowledgebase` | ✓ | | 知识库数据 |
928
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
929
+ | commands | `IAgentCommand[]` | | | 指令列表 |
930
+ | originAgentId | `number` | | | 来源智能体 ID |
931
+ | disabled | `boolean` | | | 是否禁用 |
932
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
933
+ | checked | `boolean` | | | 是否选中 |
934
+ | multiple | `boolean` | | | 是否多选 |
935
+ | isShowOperation | `boolean` | | | 是否展示操作 |
936
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
937
+ | isClickToView | `boolean` | | | 点击是否查看 |
938
+ | spaceId | `string` | | | 空间 ID |
939
+ | apiPrefix | `string` | ✓ | | API 前缀 |
940
+ | spaces | `ISpace[]` | | | 空间列表 |
941
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
942
+
943
+ **Events**
944
+
945
+ | 事件 | 参数 | 说明 |
946
+ |------|------|------|
947
+ | delete | `(knowledgebase: T)` | 删除 |
948
+ | choose | `(knowledgebase: T)` | 选择 |
949
+ | view | `(knowledgebase: T)` | 查看 |
950
+ | success-delete | `()` | 删除成功 |
951
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
952
+
953
+ **Expose**
954
+
955
+
956
+
957
+ **Slots**
958
+
959
+ | 插槽 | 参数 | 说明 |
960
+ |------|------|------|
961
+ | pre-actions | — | 操作区前置内容 |
962
+
963
+ ---
964
+
965
+ #### RenderLlmCard
966
+
967
+ LLM 模型卡片。
968
+
969
+ **Props**
970
+
971
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
972
+ |------|------|------|--------|------|
973
+ | model | `T extends IModel` | ✓ | | 模型数据 |
974
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
975
+ | commands | `IAgentCommand[]` | | | 指令列表 |
976
+ | originAgentId | `number` | | | 来源智能体 ID |
977
+ | disabled | `boolean` | | | 是否禁用 |
978
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
979
+ | checked | `boolean` | | | 是否选中 |
980
+ | isShowOperation | `boolean` | | | 是否展示操作 |
981
+ | spaceId | `string` | | | 空间 ID |
982
+ | spaces | `ISpace[]` | | | 空间列表 |
983
+ | selfHostUrl | `string` | ✓ | | 自建地址 |
984
+ | externalUrl | `string` | ✓ | | 外部地址 |
985
+ | models | `IModel[]` | ✓ | | 模型列表 |
986
+ | apiPrefix | `string` | ✓ | | API 前缀 |
987
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
988
+
989
+ **Events**
990
+
991
+ | 事件 | 参数 | 说明 |
992
+ |------|------|------|
993
+ | success-delete | `()` | 删除成功 |
994
+ | choose | `(model: T)` | 选择 |
995
+ | toggle-like | `(model: T)` | 点赞 |
996
+ | toggle-dislike | `(model: T)` | 点踩 |
997
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
998
+
999
+ **Expose**
1000
+
1001
+
1002
+
1003
+ **Slots**
1004
+
1005
+ | 插槽 | 参数 | 说明 |
1006
+ |------|------|------|
1007
+ | pre-actions | — | 操作区前置内容 |
1008
+
1009
+ ---
1010
+
1011
+ #### RenderMcpCard
1012
+
1013
+ MCP 卡片。
1014
+
1015
+ **Props**
1016
+
1017
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1018
+ |------|------|------|--------|------|
1019
+ | mcp | `T extends IMcp \| IApplicationMcp` | ✓ | | MCP 数据 |
1020
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1021
+ | commands | `IAgentCommand[]` | | | 指令列表 |
1022
+ | originAgentId | `number` | | | 来源智能体 ID |
1023
+ | disabled | `boolean` | | | 是否禁用 |
1024
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
1025
+ | checked | `boolean` | | | 是否选中 |
1026
+ | multiple | `boolean` | | | 是否多选 |
1027
+ | isShowOperation | `boolean` | | | 是否展示操作 |
1028
+ | groupType | `GroupType` | | | 分组类型 |
1029
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
1030
+ | isClickToView | `boolean` | | | 点击是否查看 |
1031
+ | spaceId | `string` | | | 空间 ID |
1032
+ | spaces | `ISpace[]` | | | 空间列表 |
1033
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1034
+ | defaultIcon | `string` | | | 默认图标 |
1035
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
1036
+ | approvalSettings | `IApprovalSetting[]` | | | 审批配置 |
1037
+
1038
+ **Events**
1039
+
1040
+ | 事件 | 参数 | 说明 |
1041
+ |------|------|------|
1042
+ | success-delete | `()` | 删除成功 |
1043
+ | success-restore | `()` | 恢复成功 |
1044
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1045
+ | edit | `(mcp: T)` | 编辑 |
1046
+ | choose | `(mcp: T)` | 选择 |
1047
+ | settings | `(mcp: T)` | 设置 |
1048
+ | view | `(mcp: T)` | 查看 |
1049
+ | delete | `(mcp: T)` | 删除 |
1050
+ | update:mcp | `(mcp: T)` | MCP 更新 |
1051
+
1052
+ **Expose**
1053
+
1054
+
1055
+
1056
+ **Slots**
1057
+
1058
+ | 插槽 | 参数 | 说明 |
1059
+ |------|------|------|
1060
+ | pre-actions | — | 操作区前置内容 |
1061
+
1062
+ ---
1063
+
1064
+ #### RenderSelectedToolsInfo
1065
+
1066
+ MCP 已选工具与审批信息。
1067
+
1068
+ **Props**
1069
+
1070
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1071
+ |------|------|------|--------|------|
1072
+ | mcp | `T extends IMcp` | ✓ | | MCP 数据 |
1073
+ | approvalSettings | `IApprovalSetting[]` | ✓ | | 审批配置 |
1074
+ | disabled | `boolean` | | | 是否禁用 |
1075
+
1076
+ **Events**
1077
+
1078
+ | 事件 | 参数 | 说明 |
1079
+ |------|------|------|
1080
+ | update:mcp | `(mcp: T)` | MCP 更新 |
1081
+
1082
+ **Expose**
1083
+
1084
+
1085
+
1086
+ **Slots**
1087
+
1088
+
1089
+
1090
+ ---
1091
+
1092
+ #### RenderPromptCard
1093
+
1094
+ Prompt 卡片。
1095
+
1096
+ **Props**
1097
+
1098
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1099
+ |------|------|------|--------|------|
1100
+ | prompt | `T extends IPrompt \| IApplicationPrompt` | ✓ | | Prompt 数据 |
1101
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1102
+ | commands | `IAgentCommand[]` | | | 指令列表 |
1103
+ | originAgentId | `number` | | | 来源智能体 ID |
1104
+ | disabled | `boolean` | | | 是否禁用 |
1105
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
1106
+ | checked | `boolean` | | | 是否选中 |
1107
+ | multiple | `boolean` | | | 是否多选 |
1108
+ | isShowOperation | `boolean` | | | 是否展示操作 |
1109
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
1110
+ | isClickToView | `boolean` | | | 点击是否查看 |
1111
+ | spaceId | `string` | | | 空间 ID |
1112
+ | spaces | `ISpace[]` | | | 空间列表 |
1113
+ | defaultModelId | `string` | ✓ | | 默认模型 ID |
1114
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1115
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
1116
+
1117
+ **Events**
1118
+
1119
+ | 事件 | 参数 | 说明 |
1120
+ |------|------|------|
1121
+ | success-delete | `()` | 删除成功 |
1122
+ | toggle-like | `()` | 点赞切换 |
1123
+ | success-restore | `()` | 恢复成功 |
1124
+ | choose | `(prompt: T)` | 选择 |
1125
+ | delete | `(prompt: T)` | 删除 |
1126
+ | view | `(prompt: T)` | 查看 |
1127
+ | edit | `(prompt: T)` | 编辑 |
1128
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1129
+
1130
+ **Expose**
1131
+
1132
+
1133
+
1134
+ **Slots**
1135
+
1136
+ | 插槽 | 参数 | 说明 |
1137
+ |------|------|------|
1138
+ | pre-actions | — | 操作区前置内容 |
1139
+
1140
+ ---
1141
+
1142
+ #### RenderRoleCard
1143
+
1144
+ 角色 / Collection 卡片。
1145
+
1146
+ **Props**
1147
+
1148
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1149
+ |------|------|------|--------|------|
1150
+ | role | `T extends ICollection \| IApplicationCollection` | ✓ | | 角色数据 |
1151
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1152
+ | commands | `IAgentCommand[]` | | | 指令列表 |
1153
+ | originAgentId | `number` | | | 来源智能体 ID |
1154
+ | disabled | `boolean` | | | 是否禁用 |
1155
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
1156
+ | checked | `boolean` | | | 是否选中 |
1157
+ | multiple | `boolean` | | | 是否多选 |
1158
+ | isShowOperation | `boolean` | | | 是否展示操作 |
1159
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
1160
+ | isClickToView | `boolean` | | | 点击是否查看 |
1161
+ | roleTypes | `ILLMPromptRole[]` | ✓ | | 角色类型列表 |
1162
+ | defaultModelId | `string` | ✓ | | 默认模型 ID |
1163
+ | spaceId | `string` | | | 空间 ID |
1164
+ | spaces | `ISpace[]` | | | 空间列表 |
1165
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1166
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
1167
+ | isSpaceManage | `boolean` | ✓ | | 是否空间管理 |
1168
+
1169
+ **Events**
1170
+
1171
+ | 事件 | 参数 | 说明 |
1172
+ |------|------|------|
1173
+ | success-delete | `()` | 删除成功 |
1174
+ | success-edit | `()` | 编辑成功 |
1175
+ | success-restore | `()` | 恢复成功 |
1176
+ | edit | `(role: ICollection)` | 编辑 |
1177
+ | copy | `(role: ICollection)` | 复制 |
1178
+ | view | `(role: ICollection)` | 查看 |
1179
+ | choose | `(role: T)` | 选择 |
1180
+ | delete | `(role: T)` | 删除 |
1181
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1182
+
1183
+ **Expose**
1184
+
1185
+
1186
+
1187
+ **Slots**
1188
+
1189
+ | 插槽 | 参数 | 说明 |
1190
+ |------|------|------|
1191
+ | pre-actions | — | 操作区前置内容 |
1192
+
1193
+ ---
1194
+
1195
+ #### RenderSkillCard
1196
+
1197
+ Skill 卡片。
1198
+
1199
+ **Props**
1200
+
1201
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1202
+ |------|------|------|--------|------|
1203
+ | skill | `ISkill` | ✓ | | Skill 数据 |
1204
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1205
+ | disabled | `boolean` | | | 是否禁用 |
1206
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
1207
+ | checked | `boolean` | | | 是否选中 |
1208
+ | multiple | `boolean` | | | 是否多选 |
1209
+ | isShowOperation | `boolean` | | | 是否展示操作 |
1210
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
1211
+ | isClickToView | `boolean` | | | 点击是否查看 |
1212
+ | spaceId | `string` | | | 空间 ID |
1213
+ | spaces | `ISpace[]` | | | 空间列表 |
1214
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1215
+ | defaultIcon | `string` | | | 默认图标 |
1216
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
1217
+
1218
+ **Events**
1219
+
1220
+ | 事件 | 参数 | 说明 |
1221
+ |------|------|------|
1222
+ | edit | `(skill: ISkill)` | 编辑 |
1223
+ | view | `(skill: ISkill)` | 查看 |
1224
+ | choose | `(skill: ISkill)` | 选择 |
1225
+ | install | `(skill: ISkill)` | 安装 |
1226
+ | update:skill | `(skill: ISkill)` | Skill 更新 |
1227
+ | success-delete | `()` | 删除成功 |
1228
+ | success-restore | `()` | 恢复成功 |
1229
+ | delete | `()` | 删除 |
1230
+ | success-download | `(downloadCount: number)` | 下载成功 |
1231
+ | show-scanner | `(content: string)` | 展示扫描内容 |
1232
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1233
+
1234
+ **Expose**
1235
+
1236
+
1237
+
1238
+ **Slots**
1239
+
1240
+ | 插槽 | 参数 | 说明 |
1241
+ |------|------|------|
1242
+ | pre-actions | — | 操作区前置内容 |
1243
+
1244
+ ---
1245
+
1246
+ #### RenderToolCard
1247
+
1248
+ Tool 卡片。
1249
+
1250
+ **Props**
1251
+
1252
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1253
+ |------|------|------|--------|------|
1254
+ | tool | `T extends ITool \| IApplicationTool` | ✓ | | Tool 数据 |
1255
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1256
+ | commands | `IAgentCommand[]` | | | 指令列表 |
1257
+ | originAgentId | `number` | | | 来源智能体 ID |
1258
+ | disabled | `boolean` | | | 是否禁用 |
1259
+ | showDeleteTips | `boolean` | | | 是否展示删除提示 |
1260
+ | checked | `boolean` | | | 是否选中 |
1261
+ | multiple | `boolean` | | | 是否多选 |
1262
+ | isShowOperation | `boolean` | | | 是否展示操作 |
1263
+ | isShowCheckbox | `boolean` | | | 是否展示复选框 |
1264
+ | isClickToView | `boolean` | | | 点击是否查看 |
1265
+ | spaceId | `string` | | | 空间 ID |
1266
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1267
+ | spaces | `ISpace[]` | | | 空间列表 |
1268
+ | showGenerateType | `boolean` | | | 是否展示生成类型 |
1269
+ | approvalSettings | `IApprovalSetting[]` | | | 审批配置 |
1270
+
1271
+ **Events**
1272
+
1273
+ | 事件 | 参数 | 说明 |
1274
+ |------|------|------|
1275
+ | success-delete | `()` | 删除成功 |
1276
+ | success-restore | `()` | 恢复成功 |
1277
+ | show-edit | `(tool: T)` | 编辑 |
1278
+ | show-debug | `(tool: T)` | 调试 |
1279
+ | view | `(tool: T)` | 查看 |
1280
+ | choose | `(tool: T)` | 选择 |
1281
+ | settings | `(tool: T)` | 设置 |
1282
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1283
+ | update:tool | `(value: ITool)` | Tool 更新 |
1284
+
1285
+ **Expose**
1286
+
1287
+
1288
+
1289
+ **Slots**
1290
+
1291
+ | 插槽 | 参数 | 说明 |
1292
+ |------|------|------|
1293
+ | pre-actions | — | 操作区前置内容 |
1294
+
1295
+ ---
1296
+
1297
+ #### RenderApprovalStrategyPopover
1298
+
1299
+ 审批策略配置 Popover。
1300
+
1301
+ **Props**
1302
+
1303
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1304
+ |------|------|------|--------|------|
1305
+ | approvalSettings | `IApprovalSetting[]` | ✓ | | 审批配置列表 |
1306
+ | approvalEnabled | `boolean` | | | 是否启用审批 |
1307
+ | approvalStrategyId | `string` | | | 策略 ID |
1308
+ | toolName | `string` | | | 工具名 |
1309
+ | disabled | `boolean` | | | 是否禁用 |
1310
+ | disabledText | `string` | | | 禁用文案 |
1311
+ | placement | `string` | | | 弹出位置 |
1312
+ | extCls | `string` | | | 额外 class |
1313
+
1314
+ **Events**
1315
+
1316
+ | 事件 | 参数 | 说明 |
1317
+ |------|------|------|
1318
+ | confirm | `(data: IApprovalSettingValue)` | 确认配置 |
1319
+
1320
+ **Expose**
1321
+
1322
+
1323
+
1324
+ **Slots**
1325
+
1326
+
1327
+
1328
+ ---
1329
+
1330
+ ### 搜索栏
1331
+
1332
+ 以下搜索组件均通过 `update:search` 双向绑定搜索条件。`RenderAgentSearch` 见 [Agent](#agent) 章节。
1333
+
1334
+ #### RenderRoleSearch
1335
+
1336
+ Collection 搜索栏。
1337
+
1338
+ **Props**
1339
+
1340
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1341
+ |------|------|------|--------|------|
1342
+ | search | `ICollectionListParam` | ✓ | | 搜索条件 |
1343
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1344
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1345
+ | isShowAllSearchOptions | `boolean` | | | 展示全部筛选项 |
1346
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1347
+ | spaceId | `string` | | | 空间 ID |
1348
+ | module | `Module` | | | 模块 |
1349
+
1350
+ **Events**
1351
+
1352
+ | 事件 | 参数 | 说明 |
1353
+ |------|------|------|
1354
+ | update:search | `(search: ICollectionListParam)` | 搜索条件变更 |
1355
+
1356
+ **Expose**
1357
+
1358
+
1359
+
1360
+ **Slots**
1361
+
1362
+
1363
+
1364
+ ---
1365
+
1366
+ #### RenderPromptSearch
1367
+
1368
+ Prompt 搜索栏。
1369
+
1370
+ **Props**
1371
+
1372
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1373
+ |------|------|------|--------|------|
1374
+ | search | `IPromptsParams` | ✓ | | 搜索条件 |
1375
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1376
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1377
+ | isShowAllSearchOptions | `boolean` | | | 展示全部筛选项 |
1378
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1379
+ | spaceId | `string` | | | 空间 ID |
1380
+ | module | `Module` | | | 模块 |
1381
+
1382
+ **Events**
1383
+
1384
+ | 事件 | 参数 | 说明 |
1385
+ |------|------|------|
1386
+ | update:search | `(search: IPromptsParams)` | 搜索条件变更 |
1387
+
1388
+ **Expose**
1389
+
1390
+
1391
+
1392
+ **Slots**
1393
+
1394
+
1395
+
1396
+ ---
1397
+
1398
+ #### RenderSkillSearch
1399
+
1400
+ Skill 搜索栏。
1401
+
1402
+ **Props**
1403
+
1404
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1405
+ |------|------|------|--------|------|
1406
+ | search | `ISkillListParam` | ✓ | | 搜索条件 |
1407
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1408
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1409
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1410
+ | spaceId | `string` | | | 空间 ID |
1411
+ | module | `Module` | | | 模块 |
1412
+
1413
+ **Events**
1414
+
1415
+ | 事件 | 参数 | 说明 |
1416
+ |------|------|------|
1417
+ | update:search | `(search: ISkillListParam)` | 搜索条件变更 |
1418
+
1419
+ **Expose**
1420
+
1421
+
1422
+
1423
+ **Slots**
1424
+
1425
+
1426
+
1427
+ ---
1428
+
1429
+ #### RenderToolSearch
1430
+
1431
+ Tool 搜索栏。
1432
+
1433
+ **Props**
1434
+
1435
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1436
+ |------|------|------|--------|------|
1437
+ | search | `IToolsParam` | ✓ | | 搜索条件 |
1438
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1439
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1440
+ | isShowAllSearchOptions | `boolean` | | | 展示全部筛选项 |
1441
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1442
+ | spaceId | `string` | | | 空间 ID |
1443
+ | module | `Module` | | | 模块 |
12
1444
 
13
- ## 主要功能
14
-
15
- ### 1. 聊天功能 (useChat)
16
-
17
- `useChat` Hook 提供完整的聊天会话管理能力,包括发送消息、接收回复、管理会话状态等功能。
18
-
19
- #### 基本用法
20
-
21
- ```typescript
22
- import { useChat } from '@blueking/ai-ui-sdk';
23
-
24
- const {
25
- currentSession, // 当前会话信息
26
- sessionContents, // 会话内容列表
27
- sendChat, // 发送消息方法
28
- stopChat, // 停止生成方法
29
- setCurrentSession, // 设置当前会话
30
- currentSessionLoading,// 当前会话加载状态
31
- reGenerateChat, // 重新生成回复
32
- reSendChat, // 重新发送消息
33
- deleteChat, // 删除消息
34
- } = useChat({
35
- // 可选回调函数
36
- handleStart: (sessionCode, sessionContent) => {
37
- // 开始生成回复时的回调
38
- },
39
- handleText: (sessionCode, sessionContent) => {
40
- // 接收到文本时的回调
41
- },
42
- handleEnd: (sessionCode, sessionContent) => {
43
- // 生成完成时的回调
44
- },
45
- // 请求配置
46
- requestOptions: {
47
- url: 'https://your-api-endpoint.com',
48
- headers: { /* 自定义请求头 */ }
49
- }
50
- });
51
-
52
- // 设置当前会话
53
- setCurrentSession({
54
- sessionCode: 'session-1',
55
- sessionName: 'My Chat',
56
- model: 'gpt-3.5',
57
- });
58
-
59
- // 发送消息
60
- sendChat({
61
- message: '你好,AI 助手',
62
- cite: '可选的引用内容',
63
- });
64
-
65
- // 停止生成回复
66
- stopChat('session-1');
67
- ```
1445
+ **Events**
68
1446
 
69
- ### 2. 内容总结 (useSummary)
70
-
71
- `useSummary` Hook 提供文本内容自动总结功能。
72
-
73
- ```typescript
74
- import { useSummary } from '@blueking/ai-ui-sdk';
75
-
76
- const { summary } = useSummary({
77
- handleStart: () => {
78
- // 开始总结时的回调
79
- },
80
- handleEnd: (summaryText) => {
81
- // 总结完成时的回调,返回总结文本
82
- },
83
- handleError: (message, code) => {
84
- // 出错时的回调
85
- }
86
- });
87
-
88
- // 使用总结功能
89
- summary({
90
- content: '需要总结的长文本内容...',
91
- url: 'https://your-summary-api.com',
92
- headers: { /* 自定义请求头 */ },
93
- model: 'gpt-3.5', // 可选的模型指定
94
- });
95
- ```
1447
+ | 事件 | 参数 | 说明 |
1448
+ |------|------|------|
1449
+ | update:search | `(search: IToolsParam)` | 搜索条件变更 |
96
1450
 
97
- ### 3. 点击代理 (useClickProxy)
1451
+ **Expose**
98
1452
 
99
- `useClickProxy` Hook 提供全局点击事件代理,用于处理代码块展开/收起、全屏显示、复制代码、下载文件等功能。
1453
+
100
1454
 
101
- ```typescript
102
- import { useClickProxy } from '@blueking/ai-ui-sdk';
1455
+ **Slots**
103
1456
 
104
- // 在组件挂载前添加全局点击代理,卸载前自动移除
105
- useClickProxy();
106
- ```
1457
+
107
1458
 
108
- ### 4. 样式管理 (useStyle)
1459
+ ---
109
1460
 
110
- `useStyle` Hook 用于引入和管理 SDK 所需的全局样式。在应用入口处调用一次即可。
1461
+ #### RenderMcpSearch
111
1462
 
112
- ```typescript
113
- import { useStyle } from '@blueking/ai-ui-sdk';
1463
+ MCP 搜索栏。
114
1464
 
115
- // 引入全局样式
116
- useStyle();
117
- ```
1465
+ **Props**
1466
+
1467
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1468
+ |------|------|------|--------|------|
1469
+ | search | `IMcpListParam` | ✓ | | 搜索条件 |
1470
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1471
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1472
+ | isShowAllSearchOptions | `boolean` | | | 展示全部筛选项 |
1473
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1474
+ | spaceId | `string` | | | 空间 ID |
1475
+ | module | `Module` | | | 模块 |
1476
+
1477
+ **Events**
1478
+
1479
+ | 事件 | 参数 | 说明 |
1480
+ |------|------|------|
1481
+ | update:search | `(search: IMcpListParam)` | 搜索条件变更 |
1482
+
1483
+ **Expose**
1484
+
1485
+
1486
+
1487
+ **Slots**
1488
+
1489
+
1490
+
1491
+ ---
1492
+
1493
+ #### RenderKnowledgeSearch
1494
+
1495
+ 知识搜索栏。
1496
+
1497
+ **Props**
1498
+
1499
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1500
+ |------|------|------|--------|------|
1501
+ | search | `IKnowledgeListParam['searchbox']` | ✓ | | 搜索条件 |
1502
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1503
+ | isSimple | `boolean` | | | 简洁模式 |
1504
+ | isShowStatus | `boolean` | | | 展示状态筛选 |
1505
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1506
+ | apiPrefix | `string` | | | API 前缀 |
1507
+ | spaceId | `string` | | | 空间 ID |
1508
+ | module | `Module` | | | 模块 |
1509
+
1510
+ **Events**
1511
+
1512
+ | 事件 | 参数 | 说明 |
1513
+ |------|------|------|
1514
+ | update:search | `(search: IKnowledgeListParam['searchbox'])` | 搜索条件变更 |
1515
+
1516
+ **Expose**
1517
+
1518
+
1519
+
1520
+ **Slots**
1521
+
1522
+
1523
+
1524
+ ---
1525
+
1526
+ #### RenderKnowledgebaseSearch
1527
+
1528
+ 知识库搜索栏。
1529
+
1530
+ **Props**
1531
+
1532
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1533
+ |------|------|------|--------|------|
1534
+ | search | `IKnowledgebaseListParam` | ✓ | | 搜索条件 |
1535
+ | memberUrl | `string` | ✓ | | 成员搜索 URL |
1536
+ | isShowAllSearchOptions | `boolean` | | | 展示全部筛选项 |
1537
+ | isShowTagSearch | `boolean` | | | 展示标签搜索 |
1538
+ | apiPrefix | `string` | | | API 前缀 |
1539
+ | spaceId | `string` | | | 空间 ID |
1540
+ | module | `Module` | | | 模块 |
1541
+
1542
+ **Events**
1543
+
1544
+ | 事件 | 参数 | 说明 |
1545
+ |------|------|------|
1546
+ | update:search | `(search: IKnowledgebaseListParam)` | 搜索条件变更 |
1547
+
1548
+ **Expose**
1549
+
1550
+
1551
+
1552
+ **Slots**
1553
+
1554
+
1555
+
1556
+ ---
1557
+
1558
+ #### RenderKnowledgeIcon
1559
+
1560
+ 知识路径类型图标。
1561
+
1562
+ **Props**
1563
+
1564
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1565
+ |------|------|------|--------|------|
1566
+ | data | `{ id?: number; pathType?: KnowledgePathType; fileType?: string }` | | | 图标数据 |
1567
+ | size | `string` | | `'12'` | 尺寸 |
1568
+
1569
+ **Events**
1570
+
1571
+
1572
+
1573
+ **Expose**
1574
+
1575
+
1576
+
1577
+ **Slots**
1578
+
1579
+
1580
+
1581
+ ---
1582
+
1583
+ ### 操作与内容
1584
+
1585
+ #### RenderRoleActions
1586
+
1587
+ 角色 / Collection 卡片操作区。
1588
+
1589
+ **Props**
1590
+
1591
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1592
+ |------|------|------|--------|------|
1593
+ | role | `ICollection` | ✓ | | 角色 |
1594
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1595
+ | defaultModelId | `string` | ✓ | | 默认模型 ID |
1596
+ | spaceId | `string` | | | 空间 ID |
1597
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1598
+ | isSpaceManage | `boolean` | ✓ | | 是否空间管理 |
1599
+
1600
+ **Events**
1601
+
1602
+ | 事件 | 参数 | 说明 |
1603
+ |------|------|------|
1604
+ | success-delete | `()` | 删除成功 |
1605
+ | success-restore | `()` | 恢复成功 |
1606
+ | edit | `(role: ICollection)` | 编辑 |
1607
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1608
+
1609
+ **Expose**
1610
+
1611
+
1612
+
1613
+ **Slots**
1614
+
1615
+
1616
+
1617
+ ---
1618
+
1619
+ #### RenderRoleContent
1620
+
1621
+ 角色 / Collection 内容预览。
1622
+
1623
+ **Props**
1624
+
1625
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1626
+ |------|------|------|--------|------|
1627
+ | role | `ICollection` | ✓ | | 角色 |
1628
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1629
+ | roleTypes | `ILLMPromptRole[]` | ✓ | | 角色类型列表 |
1630
+
1631
+ **Events**
1632
+
1633
+
1634
+
1635
+ **Expose**
1636
+
1637
+
1638
+
1639
+ **Slots**
1640
+
1641
+
1642
+
1643
+ ---
1644
+
1645
+ #### RenderPromptActions
1646
+
1647
+ Prompt 卡片操作区。
1648
+
1649
+ **Props**
1650
+
1651
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1652
+ |------|------|------|--------|------|
1653
+ | prompt | `IPrompt` | ✓ | | Prompt |
1654
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1655
+ | defaultModelId | `string` | ✓ | | 默认模型 ID |
1656
+ | spaceId | `string` | | | 空间 ID |
1657
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1658
+
1659
+ **Events**
1660
+
1661
+ | 事件 | 参数 | 说明 |
1662
+ |------|------|------|
1663
+ | success-delete | `()` | 删除成功 |
1664
+ | success-restore | `()` | 恢复成功 |
1665
+ | edit | `(val: IPrompt)` | 编辑 |
1666
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1667
+
1668
+ **Expose**
1669
+
1670
+
1671
+
1672
+ **Slots**
1673
+
1674
+
1675
+
1676
+ ---
1677
+
1678
+ #### RenderPromptContent
1679
+
1680
+ Prompt 内容展示。
1681
+
1682
+ **Props**
1683
+
1684
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1685
+ |------|------|------|--------|------|
1686
+ | content | `string` | ✓ | | 内容文本 |
1687
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1688
+
1689
+ **Events**
1690
+
1691
+
1692
+
1693
+ **Expose**
1694
+
1695
+
1696
+
1697
+ **Slots**
1698
+
1699
+
1700
+
1701
+ ---
1702
+
1703
+ #### RenderSkillActions
1704
+
1705
+ Skill 卡片操作区。
1706
+
1707
+ **Props**
1708
+
1709
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1710
+ |------|------|------|--------|------|
1711
+ | skill | `ISkill` | ✓ | | Skill |
1712
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1713
+ | spaceId | `string` | | | 空间 ID |
1714
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1715
+
1716
+ **Events**
1717
+
1718
+ | 事件 | 参数 | 说明 |
1719
+ |------|------|------|
1720
+ | edit | `(skill: ISkill)` | 编辑 |
1721
+ | install | `(skill: ISkill)` | 安装 |
1722
+ | success-delete | `()` | 删除成功 |
1723
+ | success-restore | `()` | 恢复成功 |
1724
+ | success-download | `(downloadCount: number)` | 下载成功 |
1725
+ | navigate | `(value: ISdkNavigateAction)` | 导航 |
1726
+
1727
+ **Expose**
1728
+
1729
+
1730
+
1731
+ **Slots**
1732
+
1733
+
1734
+
1735
+ ---
1736
+
1737
+ #### RenderSkillIcons
1738
+
1739
+ Skill 图标区。
1740
+
1741
+ **Props**
1742
+
1743
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1744
+ |------|------|------|--------|------|
1745
+ | skill | `ISkill` | ✓ | | Skill |
1746
+ | type | `ResourceCardType` | ✓ | | 卡片类型 |
1747
+
1748
+ **Events**
1749
+
1750
+
1751
+
1752
+ **Expose**
1753
+
1754
+
1755
+
1756
+ **Slots**
1757
+
1758
+
1759
+
1760
+ ---
1761
+
1762
+ #### RenderSkillInstall
1763
+
1764
+ Skill 安装弹窗。
1765
+
1766
+ **Props**
1767
+
1768
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1769
+ |------|------|------|--------|------|
1770
+ | isShow | `boolean` | ✓ | | 是否展示 |
1771
+ | selectedSkill | `ISkill` | ✓ | | 选中的 Skill |
1772
+ | apiPrefix | `string` | ✓ | | API 前缀 |
1773
+ | spaceId | `string` | | | 空间 ID |
1774
+
1775
+ **Events**
1776
+
1777
+ | 事件 | 参数 | 说明 |
1778
+ |------|------|------|
1779
+ | update:isShow | `(value: boolean)` | 显隐变更 |
1780
+
1781
+ **Expose**
1782
+
1783
+
1784
+
1785
+ **Slots**
118
1786
 
119
- ## 类型定义
120
-
121
- SDK 提供了丰富的类型定义,以支持 TypeScript 开发。
122
-
123
- ### 会话类型
124
-
125
- ```typescript
126
- // 会话信息
127
- interface ISession {
128
- sessionCode: string; // 会话编码
129
- sessionName: string; // 会话名称
130
- model: string; // 使用的模型
131
- roleInfo?: { // 角色信息(可选)
132
- collectionId: number;
133
- collectionName: string;
134
- content: ISessionPrompt[];
135
- variables: any[];
136
- };
137
- }
138
-
139
- // 会话内容
140
- interface ISessionContent {
141
- id?: number; // 内容ID
142
- role: SessionContentRole;// 角色类型
143
- content: string; // 内容文本
144
- status?: SessionContentStatus; // 状态
145
- sessionCode: string; // 所属会话编码
146
- cite?: string; // 引用内容
147
- time?: string; // 时间戳
148
- }
149
-
150
- // 快捷方式
151
- interface ShortCut {
152
- label: string; // 显示文本
153
- key: string; // 唯一标识
154
- prompt: string; // 提示词模板
155
- icon?: string; // 图标(可选)
156
- }
1787
+
1788
+
1789
+ ---
1790
+
1791
+ ### 数据集
1792
+
1793
+ #### RenderDataset
1794
+
1795
+ 数据集路由出口,仅渲染 `<router-view />`。
1796
+
1797
+ **Props**
1798
+
1799
+
1800
+
1801
+ **Events**
1802
+
1803
+
1804
+
1805
+ **Expose**
1806
+
1807
+
1808
+
1809
+ **Slots**
1810
+
1811
+
1812
+
1813
+ ---
1814
+
1815
+ #### RenderDatasetList
1816
+
1817
+ **Props**
1818
+
1819
+ | 属性 | 类型 | 必填 | 说明 |
1820
+ |------|------|------|------|
1821
+ | apiPrefix | `string` | ✓ | API 前缀 |
1822
+ | spaceId | `string` | | 空间 ID |
1823
+ | isInternal | `boolean` | | 内部场景 |
1824
+ | reviewDataset | `boolean` | | 审核模式 |
1825
+ | namePlaceholder | `string` | | 名称占位 |
1826
+ | codePlaceholder | `string` | | 编码占位 |
1827
+ | memberUrl | `string` | | 成员搜索 URL |
1828
+
1829
+ **Events**
1830
+
1831
+ | 事件 | 参数 |
1832
+ |------|------|
1833
+ | navigate | `(value: ISdkNavigateAction)` |
1834
+
1835
+ **Expose**
1836
+
1837
+
1838
+
1839
+ **Slots**
1840
+
1841
+
1842
+
1843
+ ---
1844
+
1845
+ #### RenderDatasetDetail
1846
+
1847
+ **Props**
1848
+
1849
+ | 属性 | 类型 | 必填 | 说明 |
1850
+ |------|------|------|------|
1851
+ | apiPrefix | `string` | ✓ | API 前缀 |
1852
+ | datasetId | `number` | ✓ | 数据集 ID |
1853
+ | spaceId | `string` | | 空间 ID |
1854
+ | isInternal | `boolean` | | 内部场景 |
1855
+
1856
+ **Events**
1857
+
1858
+ | 事件 | 参数 |
1859
+ |------|------|
1860
+ | navigate | `(value: ISdkNavigateAction)` |
1861
+
1862
+ **Expose**
1863
+
1864
+
1865
+
1866
+ **Slots**
1867
+
1868
+
1869
+
1870
+ ---
1871
+
1872
+ #### RenderDatasetDetailOriginData
1873
+
1874
+ **Props**
1875
+
1876
+ | 属性 | 类型 | 必填 | 说明 |
1877
+ |------|------|------|------|
1878
+ | apiPrefix | `string` | ✓ | API 前缀 |
1879
+ | datasetId | `number` | ✓ | 数据集 ID |
1880
+ | spaceId | `string` | | 空间 ID |
1881
+ | manageDataset | `boolean` | | 管理权限 |
1882
+ | reviewDataset | `boolean` | | 审核权限 |
1883
+ | isInternal | `boolean` | | 内部场景 |
1884
+
1885
+ **Events**
1886
+
1887
+ | 事件 | 参数 |
1888
+ |------|------|
1889
+ | update | `()` |
1890
+
1891
+ **Expose**
1892
+
1893
+
1894
+
1895
+ **Slots**
1896
+
1897
+
1898
+
1899
+ ---
1900
+
1901
+ ### 弹窗与关联
1902
+
1903
+ #### RenderResourceDialog
1904
+
1905
+ 资源选择弹窗。
1906
+
1907
+ **Props**
1908
+
1909
+ | 属性 | 类型 | 必填 | 说明 |
1910
+ |------|------|------|------|
1911
+ | isShow | `boolean` | ✓ | 是否展示 |
1912
+ | module | `Module` | ✓ | 资源模块 |
1913
+ | defaultModelId | `string` | ✓ | 默认模型 |
1914
+ | roleTypes | `ILLMPromptRole[]` | ✓ | 角色类型 |
1915
+ | spaceId | `string` | ✓ | 空间 ID |
1916
+ | memberUrl | `string` | ✓ | 成员 URL |
1917
+ | username | `string` | ✓ | 当前用户 |
1918
+ | spaces | `ISpace[]` | ✓ | 空间列表 |
1919
+ | apiPrefix | `string` | ✓ | API 前缀 |
1920
+ | title | `string` | | 标题 |
1921
+ | tools | `ITool[]` | | 已选 Tool |
1922
+ | mcps | `IMcp[]` | | 已选 MCP |
1923
+ | knowledges | `IKnowledge[]` | | 已选知识 |
1924
+ | knowledgebases | `IKnowledgebase[]` | | 已选知识库 |
1925
+ | agents | `IAgent[]` | | 已选智能体 |
1926
+ | roles | `ICollection[]` | | 已选角色 |
1927
+ | prompts | `IPrompt[]` | | 已选 Prompt |
1928
+ | skills | `ISkill[]` | | 已选 Skill |
1929
+ | agentId | `number` | | 关联智能体 ID |
1930
+ | agentCode | `string` | | 关联智能体编码 |
1931
+ | agentType | `AgentType` | | 关联智能体类型 |
1932
+ | canApply | `boolean` | | 是否可申请 |
1933
+ | multiple | `boolean` | | 是否多选 |
1934
+ | showTagSearch | `boolean` | | 是否展示标签搜索 |
1935
+ | showSpace | `boolean` | | 是否展示空间 |
1936
+ | showGenerateType | `boolean` | | 是否展示生成类型 |
1937
+ | defaultIcon | `string` | | 默认图标 |
1938
+
1939
+ **Events**
1940
+
1941
+ | 事件 | 参数 |
1942
+ |------|------|
1943
+ | update:isShow | `(isShow: boolean)` |
1944
+ | confirm | `({ tools, mcps, knowledges, knowledgebases, agents, roles, prompts, skills })` |
1945
+ | navigate | `(value: ISdkNavigateAction)` |
1946
+
1947
+ **Expose**
1948
+
1949
+
1950
+
1951
+ **Slots**
1952
+
1953
+ | 插槽 | 参数 | 说明 |
1954
+ |------|------|------|
1955
+ | pre-action | — | 操作区前置内容 |
1956
+
1957
+ ---
1958
+
1959
+ #### RenderReference
1960
+
1961
+ 资源引用关系弹层。
1962
+
1963
+ **Props**
1964
+
1965
+ | 属性 | 类型 | 必填 | 说明 |
1966
+ |------|------|------|------|
1967
+ | isShow | `boolean` | ✓ | 是否展示 |
1968
+ | module | `Module` | ✓ | 模块 |
1969
+ | apiPrefix | `string` | ✓ | API 前缀 |
1970
+ | id | `number` | | 资源 ID |
1971
+ | name | `string` | | 资源名 |
1972
+ | spaceId | `string` | | 空间 ID |
1973
+ | spaceName | `string` | | 空间名 |
1974
+
1975
+ **Events**
1976
+
1977
+ | 事件 | 参数 |
1978
+ |------|------|
1979
+ | update:isShow | `(val: boolean)` |
1980
+ | navigate | `(value: ISdkNavigateAction)` |
1981
+
1982
+ **Expose**
1983
+
1984
+
1985
+
1986
+ **Slots**
1987
+
1988
+
1989
+
1990
+ ---
1991
+
1992
+ #### RenderRelateAgent
1993
+
1994
+ 关联至智能体。
1995
+
1996
+ **Props**
1997
+
1998
+ | 属性 | 类型 | 必填 | 默认值 | 说明 |
1999
+ |------|------|------|--------|------|
2000
+ | resourceType | `Module` | ✓ | | 资源类型 |
2001
+ | resource | `IAgent \| IMcp \| ISkill \| IModel \| ITool \| IKnowledgebase \| IPrompt \| ICollection` | ✓ | | 资源 |
2002
+ | apiPrefix | `string` | ✓ | | API 前缀 |
2003
+ | disabled | `boolean` | | | 禁用 |
2004
+ | disabledText | `string` | | `''` | 禁用文案 |
2005
+ | text | `boolean` | | `true` | 展示文字 |
2006
+ | boundary | `string` | | | 边界 |
2007
+ | placement | `string` | | `'right'` | 弹出位置 |
2008
+ | spaceId | `string` | | | 空间 ID |
2009
+
2010
+ **Events**
2011
+
2012
+ | 事件 | 参数 |
2013
+ |------|------|
2014
+ | navigate | `(value: ISdkNavigateAction)` |
2015
+
2016
+ **Expose**
2017
+
2018
+
2019
+
2020
+ **Slots**
2021
+
2022
+ | 插槽 | 参数 | 说明 |
2023
+ |------|------|------|
2024
+ | trigger | `{ handleShow }` | 触发器(作用域插槽) |
2025
+
2026
+ ---
2027
+
2028
+ ### Markdown
2029
+
2030
+ #### RenderMarkdownEdit
2031
+
2032
+ Toast UI Markdown 编辑器。
2033
+
2034
+ **Props**
2035
+
2036
+ | 属性 | 类型 | 必填 | 默认值 |
2037
+ |------|------|------|--------|
2038
+ | modelValue | `string` | | |
2039
+ | placeholder | `string` | | |
2040
+ | height | `string` | | `'500px'` |
2041
+ | disabled | `boolean` | | |
2042
+ | fontSize | `string` | | `'14px'` |
2043
+ | backgroundColor | `string` | | `'#fff'` |
2044
+ | mode | `'markdown' \| 'wysiwyg'` | | `'wysiwyg'` |
2045
+ | isSimpleToolbar | `boolean` | | `false` |
2046
+
2047
+ **Events**
2048
+
2049
+ | 事件 | 参数 |
2050
+ |------|------|
2051
+ | update:modelValue | `(value: string)` |
2052
+
2053
+ **Expose**
2054
+
2055
+
2056
+
2057
+ **Slots**
2058
+
2059
+
2060
+
2061
+ ---
2062
+
2063
+ #### RenderMarkdown
2064
+
2065
+ Toast UI Markdown 只读预览。
2066
+
2067
+ **Props**
2068
+
2069
+ | 属性 | 类型 | 必填 | 默认值 |
2070
+ |------|------|------|--------|
2071
+ | value | `string` | | |
2072
+ | previewBackground | `string` | | `'#fff'` |
2073
+ | padding | `string` | | `'12px 16px'` |
2074
+
2075
+ **Events**
2076
+
2077
+
2078
+
2079
+ **Expose**
2080
+
2081
+
2082
+
2083
+ **Slots**
2084
+
2085
+
2086
+
2087
+ ---
2088
+
2089
+ ### 命令式 API
2090
+
2091
+ #### renderAuthDialog
2092
+
2093
+ 动态挂载权限申请弹窗(非 Vue 组件)。
2094
+
2095
+ ```ts
2096
+ import { renderAuthDialog } from '@blueking/ai-ui-sdk/components';
2097
+
2098
+ renderAuthDialog(perm: IPermissionApplyData, cancelCallback?: Function): void
157
2099
  ```
158
2100
 
159
- ### 枚举值
160
-
161
- ```typescript
162
- // 会话内容角色
163
- enum SessionContentRole {
164
- Ai = 'ai', // AI 回复
165
- User = 'user', // 用户消息
166
- System = 'system', // 系统消息
167
- // ... 更多角色类型
168
- }
169
-
170
- // 会话内容状态
171
- enum SessionContentStatus {
172
- Fail = 'fail', // 失败
173
- Loading = 'loading', // 加载中
174
- Success = 'success', // 成功
175
- }
2101
+ ---
2102
+
2103
+ ## Hooks
2104
+
2105
+ `@blueking/ai-ui-sdk/hooks` 引入。
2106
+
2107
+ | Hook | 参数 | 返回 / 说明 |
2108
+ |------|------|-------------|
2109
+ | `useStyle` | — | 副作用注入 SDK CSS,入口调用一次 |
2110
+ | `useClickProxy` | `disabledClassName?: string` | 全局点击代理(折叠 / 全屏 / 复制 / 下载) |
2111
+ | `useFormLeaveConfirm` | — | `{ handleInitFormLeaveConfirm, handleFormLeaveConfirm }` |
2112
+ | `usePermission` | `apiPrefix, spaceId?: Ref<string>, backgroundColor?` | `{ handleMouseEnter, handleMouseMove, handleMouseLeave, handleMouseClick, handleCheckPermission }` |
2113
+ | `useMemberHttp` | — | `{ getMemberList(memberUrl, search) }` |
2114
+ | `useTTable` | — | `{ isLoading, initHook, sort, handleSortChange, triggerApi, pagination, resetPagination, tableData, handlePageChange, handlePageSizeChange }` |
2115
+ | `useEllipsisTooltip` | — | `{ handleInitEllipsisTooltip }` |
2116
+ | `useCommonHttp` | `apiPrefix, spaceId?: Ref<string>` | `{ getTagTree }` |
2117
+ | `useLoadingVersion` | — | `{ loading, startLoading }`(`startLoading` 返回结束函数) |
2118
+ | `useCollection` | `roleTypes: ILLMPromptRole[]` | Collection 展示辅助方法集合 |
2119
+ | `useScrollLoad` | `{ targetCls, defaultPageSize?, triggerApi, handleDataLoaded?, handleDataUpdated?, abort? }` | `{ isLoading, datas, handleInitData, handleInitDataImmediately, handleRefreshData, handleRefreshDataWithoutLoading, scrollLoadMore }` |
2120
+ | `useClickoutside` | — | `{ handleInitClickoutside(wrapClassName, callback) }` |
2121
+
2122
+ ---
2123
+
2124
+ ## HTTPS Hooks
2125
+
2126
+ 从 `@blueking/ai-ui-sdk/https` 引入。统一签名多为 `(apiPrefix: string, spaceId?: Ref<string>)`。
2127
+
2128
+ | Hook | 主要方法 |
2129
+ |------|----------|
2130
+ | `useAgentHttp` | `getAgentList`、`getAgent`、`debugAgent`、`updateAgent`、`deleteAgent`、`restoreAgent`、`getRelatedAgentCommands`、`resourceApply`、`getAgentCount`、`getAgentReferringAgents`、`getAgentMcpPermission` |
2131
+ | `useCollectionHttp` | `getCollections`、`getCollectionCount`、`deleteCollection`、`restoreCollection`、`getCollectionReferringAgents`、`parseCollection`、`parseCollectionVariable` |
2132
+ | `useCredentialHttp` | `getCredentialReferenceList` |
2133
+ | `useKnowledgeHttp` | `getKnowledgebases`、`getKnowledges`、`getKnowledgebaseCount`、`getKnowledgeCount`、`getKnowledgebaseReferringAgents` |
2134
+ | `useMcpHttp` | `getMcpList`、`deleteMcp`、`getMcpConfig`、`restoreMcp`、`getMcpCount`、`getMcpReferringAgents`、`getMcpInstallGuide`、`getMcpInstallTargets` |
2135
+ | `useSkillHttp` | `getSkillList`、`getSkillCount`、`getSkillReferringAgents`、`deleteSkill`、`downloadSkill`、`restoreSkill`、安装/指南相关、`getSkillBuildLog` |
2136
+ | `useSpaceHttp` | `getResourceAuthorizedSpaces`、`removeApplyResources`、`getUsableSpaces` |
2137
+ | `useMarketHttp` | `downloadMarketSkill` |
2138
+ | `useLlmHttp` | `getModels`、`cancelModelLikeOrDislike`、`submitModelLikeOrDislike`、`getLLMReferringAgents` |
2139
+ | `useMetaHttp` | `nameValidator`、`codeValidator`、`getTags`、`plusTag`、`checkTag` |
2140
+ | `usePromptHttp` | `getPrompts`、`togglePromptLike`、`deletePrompt`、`restorePrompt`、`getPromptCount` |
2141
+ | `useToolHttp` | `getTools`、`deleteTool`、`restoreTool`、`getToolCount`、`getToolReferringAgents` |
2142
+ | `useDatasetHttp` | 数据集 CRUD、数据项、审核、标签等 |
2143
+
2144
+ ---
2145
+
2146
+ ## Events / Enums / Constants / Util / Transforms
2147
+
2148
+ ### Events(`@blueking/ai-ui-sdk/events`)
2149
+
2150
+ ```ts
2151
+ import { addEventListener, removeEventListener, emitEvent } from '@blueking/ai-ui-sdk/events';
2152
+ import { EventType } from '@blueking/ai-ui-sdk/enums';
2153
+
2154
+ addEventListener(EventType.Error, (data) => { /* ... */ });
176
2155
  ```
177
2156
 
178
- ## 完整示例
2157
+ 当前内置事件:`EventType.Error`。
2158
+
2159
+ ### 常用枚举(`@blueking/ai-ui-sdk/enums`)
2160
+
2161
+ | 枚举 | 取值示例 |
2162
+ |------|----------|
2163
+ | `ResourceCardType` | `full` / `choose` / `info` / `application` / `record` / `market` |
2164
+ | `GroupType` | `all` / `space` / `user` / `deleted` |
2165
+ | `Module` | knowledgebase / knowledge / prompt / tool / collection / agent / mcp / skill … |
2166
+ | `AgentType` | `single` / `flow` |
2167
+ | `EnumCharacter` | `all` / `system` / `user` / `public` / `space` |
2168
+ | `SdkNavigateActionType` | 各模块导航动作 |
2169
+
2170
+ ### Constants
179
2171
 
180
- 下面是一个完整的使用示例,展示了如何在 Vue 3 组件中集成 SDK:
2172
+ - `MAX_PAGE_SIZE = 10000`
2173
+ - `TEN_SECONDS = 10000`
2174
+ - `MODULE_NAME`:`Module` → 中文名映射
2175
+
2176
+ ### Util / Transforms / Types
2177
+
2178
+ - `util`:文件处理、拷贝、下载、防抖节流、`uuid`、`deepMerge`、Markdown XSS 相关辅助等
2179
+ - `transforms`:各资源 `transferXxxApi2Xxx` / `transferXxx2XxxApi`
2180
+ - `types`:按域导出 `agent` / `mcp` / `skill` / `tool` / `knowledge` / `dataset` / `prompt` / `collection` 等类型
2181
+
2182
+ ---
2183
+
2184
+ ## 使用示例
181
2185
 
182
2186
  ```vue
183
2187
  <template>
184
- <div class="chat-container">
185
- <!-- 消息列表 -->
186
- <div class="message-list">
187
- <div v-for="message in sessionContents" :key="message.id" class="message">
188
- <div class="avatar">
189
- {{ message.role === 'user' ? '👤' : '🤖' }}
190
- </div>
191
- <div class="content">{{ message.content }}</div>
192
- </div>
193
- </div>
194
-
195
- <!-- 输入框 -->
196
- <div class="input-area">
197
- <input
198
- v-model="inputMessage"
199
- @keyup.enter="handleSend"
200
- placeholder="请输入消息..."
201
- />
202
- <button @click="handleSend" :disabled="currentSessionLoading">
203
- {{ currentSessionLoading ? '生成中...' : '发送' }}
204
- </button>
205
- <button v-if="currentSessionLoading" @click="handleStop">停止</button>
206
- </div>
2188
+ <RenderHeader
2189
+ title="智能体"
2190
+ v-model:group-type="groupType"
2191
+ :tabs="tabs"
2192
+ />
2193
+ <RenderAgentSearch
2194
+ v-model:search="search"
2195
+ :api-prefix="apiPrefix"
2196
+ :member-url="memberUrl"
2197
+ :space-id="spaceId"
2198
+ />
2199
+ <div class="card-list">
2200
+ <RenderAgentCard
2201
+ v-for="agent in agents"
2202
+ :key="agent.id"
2203
+ :agent="agent"
2204
+ :type="ResourceCardType.Full"
2205
+ :api-prefix="apiPrefix"
2206
+ :space-id="spaceId"
2207
+ @navigate="handleNavigate"
2208
+ @success-delete="refresh"
2209
+ />
207
2210
  </div>
208
2211
  </template>
209
2212
 
210
2213
  <script setup lang="ts">
211
2214
  import { ref } from 'vue';
212
- import { useChat, useStyle, useClickProxy } from '@blueking/ai-ui-sdk';
2215
+ import {
2216
+ RenderHeader,
2217
+ RenderAgentSearch,
2218
+ RenderAgentCard,
2219
+ } from '@blueking/ai-ui-sdk/components';
2220
+ import { useStyle } from '@blueking/ai-ui-sdk/hooks';
2221
+ import { ResourceCardType, GroupType } from '@blueking/ai-ui-sdk/enums';
2222
+ import type { IAgent, IAgentListParam, ISdkNavigateAction } from '@blueking/ai-ui-sdk/types';
213
2223
 
214
- // 引入全局样式
215
2224
  useStyle();
216
2225
 
217
- // 添加点击代理
218
- useClickProxy();
2226
+ const apiPrefix = '/api';
2227
+ const memberUrl = '/member';
2228
+ const spaceId = ref('');
2229
+ const groupType = ref(GroupType.All);
2230
+ const search = ref<IAgentListParam>({});
2231
+ const agents = ref<IAgent[]>([]);
2232
+ const tabs = [
2233
+ { id: GroupType.All, name: '全部', number: 0 },
2234
+ ];
219
2235
 
220
- // 初始化聊天功能
221
- const {
222
- currentSession,
223
- sessionContents,
224
- sendChat,
225
- stopChat,
226
- setCurrentSession,
227
- currentSessionLoading,
228
- } = useChat({
229
- handleStart: () => {
230
- console.log('开始生成回复');
231
- },
232
- handleEnd: () => {
233
- console.log('回复生成完成');
234
- },
235
- requestOptions: {
236
- url: 'https://your-chat-api.com',
237
- }
238
- });
239
-
240
- // 设置当前会话
241
- setCurrentSession({
242
- sessionCode: 'session-' + Date.now(),
243
- sessionName: '新对话',
244
- model: 'gpt-3.5',
245
- });
246
-
247
- const inputMessage = ref('');
248
-
249
- // 发送消息
250
- const handleSend = () => {
251
- if (!inputMessage.value.trim()) return;
252
-
253
- sendChat({
254
- message: inputMessage.value,
255
- });
256
-
257
- inputMessage.value = '';
2236
+ const handleNavigate = (action: ISdkNavigateAction) => {
2237
+ // 处理 SDK 导航动作
258
2238
  };
259
2239
 
260
- // 停止生成
261
- const handleStop = () => {
262
- if (currentSession.value?.sessionCode) {
263
- stopChat(currentSession.value.sessionCode);
264
- }
2240
+ const refresh = () => {
2241
+ // 刷新列表
265
2242
  };
266
2243
  </script>
267
2244
  ```
268
2245
 
269
2246
  ## 注意事项
270
2247
 
271
- 1. 确保在应用中只调用一次 `useStyle()` 以避免样式重复注入
272
- 2. `useClickProxy()` 应在组件挂载前调用,会自动在组件卸载时移除事件监听
273
- 3. 发送消息前必须通过 `setCurrentSession()` 设置当前会话
274
- 4. 所有网络请求需要在 `requestOptions` 中配置正确的 API 地址
275
-
276
- ## 高级功能
277
-
278
- SDK 还提供了以下高级功能:
279
-
280
- - 支持引用上下文进行提问
281
- - 支持快捷操作菜单配置
282
- - 支持代码块的展开/收起、全屏显示、复制、下载
283
- - 支持响应内容的重新生成和删除
284
- - 支持会话内容的自动滚动
2248
+ 1. 通过**子路径**引入模块,不要依赖根路径默认导出。
2249
+ 2. `useStyle()` 建议在应用入口只调用一次,避免样式重复注入。
2250
+ 3. `useClickProxy()` 会在挂载时注册、卸载时移除全局点击监听。
2251
+ 4. 卡片类组件的 `navigate` 事件需由宿主完成实际路由跳转。
2252
+ 5. 类型与枚举请从 `@blueking/ai-ui-sdk/types`、`@blueking/ai-ui-sdk/enums` 引入。
285
2253
 
286
2254
  ## 版本兼容性
287
2255
 
288
- - 需要 Vue 3.x
289
- - TypeScript 4.x 或更高版本
290
- - 现代浏览器(Chrome, Firefox, Safari, Edge)
2256
+ - Vue 3.x
2257
+ - TypeScript 4.x+
2258
+ - 现代浏览器(Chrome / Firefox / Safari / Edge)