@blueking/chat-x 0.0.45-beta.1 → 0.0.45-beta.3
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/dist/ag-ui/types/contents.d.ts +5 -0
- package/dist/ag-ui/types/interrupt.d.ts +35 -5
- package/dist/components/ai-buttons/tool-btn/tool-btn.vue.d.ts +11 -1
- package/dist/components/chat-content/flow-agent-content/flow-agent-content.vue.d.ts +4 -0
- package/dist/components/chat-content/flow-agent-content/flow-agent-node-detail.vue.d.ts +2 -0
- package/dist/components/chat-content/flow-agent-content/flow-agent-state.d.ts +34 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-agent.d.ts +51 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +32 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-tab.d.ts +18 -0
- package/dist/components/chat-content/index.d.ts +2 -0
- package/dist/components/chat-input/ai-slash-input/ai-skill-list/ai-skill-list.vue.d.ts +8 -0
- package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +3 -1
- package/dist/components/chat-input/chat-input.vue.d.ts +3 -1
- package/dist/components/chat-message/activity-message/activity-message.vue.d.ts +4 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-common.d.ts +1 -1
- package/dist/composables/use-custom-tab.d.ts +1 -1
- package/dist/composables/use-full-screen.d.ts +17 -0
- package/dist/composables/use-message-group.d.ts +9 -0
- package/dist/icons/execution.d.ts +3 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/screen.d.ts +6 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4335 -4108
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +5 -1
- package/dist/mcp/generated/docs/activity-message.md +33 -9
- package/dist/mcp/generated/docs/chat-container.md +78 -19
- package/dist/mcp/generated/docs/file-upload-btn.md +1 -1
- package/dist/mcp/generated/docs/flow-agent-content.md +47 -7
- package/dist/mcp/generated/docs/interrupt-message.md +2 -2
- package/dist/mcp/generated/docs/interrupt.md +80 -8
- package/dist/mcp/generated/docs/markdown-content.md +23 -0
- package/dist/mcp/generated/docs/message-container.md +1 -1
- package/dist/mcp/generated/docs/message-render.md +3 -3
- package/dist/mcp/generated/docs/message-tools.md +3 -3
- package/dist/mcp/generated/docs/shortcut-render.md +5 -1
- package/dist/mcp/generated/docs/tool-approval-card.md +2 -2
- package/dist/mcp/generated/docs/tool-btn.md +37 -6
- package/dist/mcp/generated/docs/use-flow-node-actions.md +124 -0
- package/dist/mcp/generated/docs/use-full-screen.md +114 -0
- package/dist/mcp/generated/index.json +33 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/markdown-bk-inline-style.d.ts +20 -0
- package/dist/types/custom.d.ts +1 -0
- package/dist/types/editor.d.ts +6 -0
- package/dist/types/input.d.ts +1 -1
- package/dist/types/tool.d.ts +3 -3
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -502,7 +502,7 @@ AI 回复状态为 `error` 时,消息以错误样式展示:
|
|
|
502
502
|
| messageGroups | `MessageGroup[]` | — | 预计算的消息分组;传入时跳过内部分组逻辑,由 `ChatContainer` 通过 `useMessageGroup` 提供 |
|
|
503
503
|
| messageStatus | `MessageStatus` | — | 当前整体消息状态,控制底部「停止生成」按钮显示;`ChatContainer` 会结合末尾 Loading 占位推导 `fetching` 等再传入 |
|
|
504
504
|
| messageToolsStatus | `MessageToolsStatus` | — | 工具栏状态,透传给 `MessageTools` 和 `MessageRender` |
|
|
505
|
-
| messageToolsTippyOptions | `AITippyProps` | — | 透传给 `MessageTools` 和 `MessageRender`(进而透传给 `UserMessage` 的工具栏)的 Tippy 配置,用于自定义 tooltip
|
|
505
|
+
| messageToolsTippyOptions | `AITippyProps` | — | 透传给 `MessageTools` 和 `MessageRender`(进而透传给 `UserMessage` 的工具栏)的 Tippy 配置,用于自定义 tooltip 挂载点、位置等(如 `appendTo`、`placement`、`zIndex`) |
|
|
506
506
|
| enableSelection | `boolean` | `false` | 是否启用多选模式 |
|
|
507
507
|
| onAgentAction | `(tool: IToolBtn, messages: Message[]) => Promise<string[] \| void>` | — | AI 消息工具操作回调;`copy` 操作由内部处理,`like/unlike` 应返回反馈原因字符串数组 |
|
|
508
508
|
| onAgentFeedback | `(tool: IToolBtn, messages: Message[], reasonList: string[], otherReason: string) => void` | — | AI 消息反馈提交回调(点赞/踩选完原因后触发) |
|
|
@@ -39,7 +39,7 @@ MessageRender
|
|
|
39
39
|
│ ├── 'info' → InfoMessage(转发 message)
|
|
40
40
|
│ ├── 'reasoning' → ReasoningMessage(转发 message)
|
|
41
41
|
│ ├── 'tool' → ToolMessage(转发 message)
|
|
42
|
-
│ ├── 'activity' → ActivityMessage(转发 message)
|
|
42
|
+
│ ├── 'activity' → ActivityMessage(转发 message + onInterruptResume)
|
|
43
43
|
│ ├── 'loading' → LoadingMessage(转发 message)
|
|
44
44
|
│ ├── 'interrupt' → InterruptMessageRender(转发 message + onInterruptResume)
|
|
45
45
|
│ │
|
|
@@ -274,7 +274,7 @@ slot 参数类型与 `AssistantMessage` 的 slot 保持一致(`Partial<Assista
|
|
|
274
274
|
| messageToolsStatus | `MessageToolsStatus` | — | 工具按钮状态;**仅转发给 `UserMessage`** |
|
|
275
275
|
| onAction | `(tool: IToolBtn) => Promise<string[] \| void>` | — | 工具操作回调;**仅转发给 `UserMessage`** |
|
|
276
276
|
| onInputConfirm | `(content: UserMessage['content'], docSchema: TagSchema) => Promise<void>` | — | 用户编辑确认回调;**仅转发给 `UserMessage`** |
|
|
277
|
-
| onInterruptResume | `(payload: InterruptResume, interrupt
|
|
277
|
+
| onInterruptResume | `(payload: InterruptResume, interrupt?: Interrupt) => Promise<void>` | — | 中断 / FlowAgent 节点操作回调;转发给 `InterruptMessageRender` 与 `ActivityMessage`(后者仅 `flow_agent` 子组件消费) |
|
|
278
278
|
| onShortcutConfirm | `(formModel: Record<string, unknown>) => Promise<void>` | — | 用户快捷指令提交回调;**仅转发给 `UserMessage`** |
|
|
279
279
|
| tippyOptions | `Partial<Omit<TippyOptions, 'getReferenceClientRect' \| 'triggerTarget'>>` | — | 自定义 Tippy 配置;**仅转发给 `UserMessage`** |
|
|
280
280
|
|
|
@@ -295,7 +295,7 @@ slot 参数类型与 `AssistantMessage` 的 slot 保持一致(`Partial<Assista
|
|
|
295
295
|
| `info` | `InfoMessage` | `message` | 系统信息 / 会话分隔符 |
|
|
296
296
|
| `reasoning` | `ReasoningMessage` | `message` | AI 思考过程(可折叠) |
|
|
297
297
|
| `tool` | `ToolMessage` | `message` | 工具调用返回结果 |
|
|
298
|
-
| `activity` | `ActivityMessage` | `message`
|
|
298
|
+
| `activity` | `ActivityMessage` | `message` + `onInterruptResume` | 知识检索 / 引用文档 / FlowAgent 执行(节点重试 / 跳过) |
|
|
299
299
|
| `loading` | `LoadingMessage` | `message`(字段被忽略,组件无 Props) | 等待响应的加载占位 |
|
|
300
300
|
| `interrupt` | `InterruptMessageRender` | `message` + `onInterruptResume` | human-in-the-loop 中断 |
|
|
301
301
|
| 其他 / 未知 | — | — | 返回 `null`,不渲染 |
|
|
@@ -363,9 +363,9 @@ const CONST_UPDATE_TOOLS = [
|
|
|
363
363
|
import { MessageToolsStatus, type IToolBtn } from '@blueking/chat-x';
|
|
364
364
|
|
|
365
365
|
interface IToolBtn {
|
|
366
|
-
id
|
|
367
|
-
name
|
|
368
|
-
description
|
|
366
|
+
id?: keyof typeof ToolIconsMap; // 工具唯一标识;与 ToolIconsMap 匹配时显示内置图标,否则显示 name 文本
|
|
367
|
+
name?: string; // 工具名称,无对应图标时显示;也用作 tooltip fallback
|
|
368
|
+
description?: string; // tooltip 文本
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
enum MessageToolsStatus {
|
|
@@ -349,7 +349,7 @@ const components: ShortcutComponent[] = [
|
|
|
349
349
|
| ------------- | ------------------------------------ | ---- | ------------------------------------------------------------------------------------------ |
|
|
350
350
|
| type | 见[表单类型](#表单组件类型) | ✓ | 控件类型;未知类型返回 `null`,不渲染 |
|
|
351
351
|
| key | `string` | ✓ | 表单字段名;`submit` 事件返回对象以此为 key;同时作为校验 property |
|
|
352
|
-
| name | `string` | — |
|
|
352
|
+
| name | `string` | — | 表单项标签;优先于 `formItemProps.label`,通过 `#label` 插槽渲染为 `.shortcut-render-form-label` |
|
|
353
353
|
| default | `string` | — | 字段初始值;优先于 `formModel`,在 `watchEffect` 中覆盖写入 |
|
|
354
354
|
| fillBack | `boolean` | — | `true` 时映射为 `required: true`(必填校验),同时标记回填语义 |
|
|
355
355
|
| placeholder | `string` | — | 占位文本(`input` / `textarea` / `number` 可用) |
|
|
@@ -416,6 +416,10 @@ interface BaseShortcutComponent {
|
|
|
416
416
|
}
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
+
## 样式说明
|
|
420
|
+
|
|
421
|
+
表单项与控件会附加类型化 class,便于样式覆盖:`shortcut-render-form-item_{type}`(如 `_radio`、`_checkbox`),单选/多选项子项为 `shortcut-render-form-item_radio` / `shortcut-render-form-item_checkbox`。表单项标签使用 BEM 风格类名 `shortcut-render-form-label`。
|
|
422
|
+
|
|
419
423
|
## 关联组件
|
|
420
424
|
|
|
421
425
|
- [ShortcutBtn](/components/input/shortcut-btn) — 与 Shortcut 数据模型一致的入口按钮
|
|
@@ -129,11 +129,11 @@ ToolApprovalCard
|
|
|
129
129
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
130
130
|
| ----------------- | ---------------------------- | ------ | -------------------------------------------- |
|
|
131
131
|
| interrupt | `AIDevToolApprovalInterrupt` | — | **必填**,含 `metadata.ticket` |
|
|
132
|
-
| onInterruptResume | `OnInterruptResume` | — | 取消审批时触发,签名为 `(payload, interrupt)`,payload 为 `{
|
|
132
|
+
| onInterruptResume | `OnInterruptResume` | — | 取消审批时触发,签名为 `(payload, interrupt)`,payload 为 `{ operation: InterruptResumeOperation.ApprovalCancel, payload: { interrupt_id } }` |
|
|
133
133
|
|
|
134
134
|
### Events / Slots / Expose
|
|
135
135
|
|
|
136
|
-
无。打开链接、复制剪贴板在组件内部完成;取消审批通过 `onInterruptResume({
|
|
136
|
+
无。打开链接、复制剪贴板在组件内部完成;取消审批通过 `onInterruptResume({ operation: InterruptResumeOperation.ApprovalCancel, payload: { interrupt_id: interrupt.id } }, interrupt)` 通知业务侧处理。
|
|
137
137
|
|
|
138
138
|
## 依赖
|
|
139
139
|
|
|
@@ -30,8 +30,9 @@ div.ai-tool-btn(v-tippy,flex,min-width: 20px,height: 20px,border-radiu
|
|
|
30
30
|
disabled=true → .is-disabled(color: #979ba5; cursor: not-allowed)
|
|
31
31
|
:not(.is-disabled):hover → color: #4d4f56; background: #eaebf0
|
|
32
32
|
│
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
└── <slot>(默认内容,可完全自定义)
|
|
34
|
+
├── [id && id in ToolIconsMap] → <component :is="ToolIconsMap[id]" />(SVG 图标)
|
|
35
|
+
└── [其他] → <div>{{ name }}</div>(文本回退,XSS 安全)
|
|
35
36
|
|
|
36
37
|
Tippy:content=description, theme='ai-chat-box', disabled=true 时 onShow 返回 false 不显示
|
|
37
38
|
click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
@@ -56,7 +57,7 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
56
57
|
| `activeLike` | 点赞(实心) | 激活态填充图标 |
|
|
57
58
|
| `activeUnLike` | 不满意(实心) | 激活态填充图标 |
|
|
58
59
|
|
|
59
|
-
> `id` 不在上表时,组件渲染 `<div>{{ name }}</div>`
|
|
60
|
+
> 未传入 `id`、或 `id` 不在上表时,组件渲染 `<div>{{ name }}</div>` 作为文本回退。也可通过默认插槽完全自定义按钮内容(如全屏图标),此时可不传 `id`。
|
|
60
61
|
|
|
61
62
|
## 基础用法
|
|
62
63
|
|
|
@@ -192,7 +193,31 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
192
193
|
|
|
193
194
|
## 未知 ID 的文本回退
|
|
194
195
|
|
|
195
|
-
`id` 不在 `ToolIconsMap` 时渲染 `name`
|
|
196
|
+
`id` 不在 `ToolIconsMap` 时渲染 `name` 文本,适用于自定义扩展场景:
|
|
197
|
+
|
|
198
|
+
## 自定义插槽内容
|
|
199
|
+
|
|
200
|
+
通过默认插槽可完全替换内置图标/文本,适用于预置 `ToolIconsMap` 未覆盖的图标场景(如侧栏全屏按钮):
|
|
201
|
+
|
|
202
|
+
```vue
|
|
203
|
+
<template>
|
|
204
|
+
<ToolBtn
|
|
205
|
+
description="全屏"
|
|
206
|
+
:tippy-options="{ content: '全屏' }"
|
|
207
|
+
@click="handleFullScreen"
|
|
208
|
+
>
|
|
209
|
+
<FullScreenIcon />
|
|
210
|
+
</ToolBtn>
|
|
211
|
+
</template>
|
|
212
|
+
|
|
213
|
+
<script setup lang="ts">
|
|
214
|
+
import { ToolBtn, FullScreenIcon } from '@blueking/chat-x';
|
|
215
|
+
|
|
216
|
+
const handleFullScreen = () => {
|
|
217
|
+
// 进入全屏逻辑
|
|
218
|
+
};
|
|
219
|
+
</script>
|
|
220
|
+
```
|
|
196
221
|
|
|
197
222
|
## API
|
|
198
223
|
|
|
@@ -200,7 +225,7 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
200
225
|
|
|
201
226
|
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
202
227
|
| ------------ | -------------------------------------------------------------------------- | ---- | ------ | ------------------------------------------------------------------------------------------------------------------ |
|
|
203
|
-
| id | `keyof typeof ToolIconsMap` |
|
|
228
|
+
| id | `keyof typeof ToolIconsMap` | 否 | — | 按钮标识;在 `ToolIconsMap` 中时渲染对应 SVG 图标,否则渲染 `name` 文本;使用插槽自定义内容时可省略 |
|
|
204
229
|
| name | `string` | 否 | — | 按钮名称;`id` 无对应图标时作为文本内容渲染 |
|
|
205
230
|
| description | `string` | 否 | — | Tippy tooltip 内容;`disabled=true` 时不显示 tooltip |
|
|
206
231
|
| active | `boolean` | 否 | — | 激活态;`true` 时追加 `.is-active`(字色由 `id` 决定:`like`/`activeLike` 为蓝色 `#3a84ff`,其他为红色 `#E71818`) |
|
|
@@ -213,12 +238,18 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
213
238
|
| ------ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
214
239
|
| click | `(data: IToolBtn & { active?: boolean; disabled?: boolean }, event: MouseEvent)` | 点击时触发;`data` 为组件当前全量 props(含 `active`/`disabled`);`disabled=true` 时不触发 |
|
|
215
240
|
|
|
241
|
+
### Slots
|
|
242
|
+
|
|
243
|
+
| 插槽名 | 说明 |
|
|
244
|
+
| ------- | ------------------------------------------------------------------------------------------ |
|
|
245
|
+
| default | 按钮内容;传入时替换默认的图标/文本渲染逻辑,常用于自定义 SVG 图标(如全屏、退出全屏按钮) |
|
|
246
|
+
|
|
216
247
|
## 类型定义
|
|
217
248
|
|
|
218
249
|
```typescript
|
|
219
250
|
// 来自 @blueking/chat-x 导出
|
|
220
251
|
interface IToolBtn {
|
|
221
|
-
id
|
|
252
|
+
id?: keyof typeof ToolIconsMap; // 预置 ID;省略时走 name 文本或插槽
|
|
222
253
|
name?: string;
|
|
223
254
|
description?: string;
|
|
224
255
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!-- AI SUMMARY -->
|
|
2
|
+
## 快速了解
|
|
3
|
+
|
|
4
|
+
useFlowNodeActions 接收 onInterruptResume 与 openNodeDetail,返回 getNodeActions(task, node)。 失败节点按 retryable/skippable 展示重试/跳过,详情恒在末尾;点击 resume 时不传 interrupt。
|
|
5
|
+
|
|
6
|
+
### 关联组件
|
|
7
|
+
- **flow-agent-content** — FlowAgentContent 内部消费,驱动节点行尾按钮组渲染
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
<!-- FULL DOC -->
|
|
11
|
+
|
|
12
|
+
# useFlowNodeActions 节点行尾操作
|
|
13
|
+
|
|
14
|
+
> **分类**:composable
|
|
15
|
+
|
|
16
|
+
将 FlowAgent 节点行尾的「详情(打开侧栏)」与「重试 / 跳过(回传 Agent resume)」聚合为统一的声明式操作列表。`FlowAgentContent` 只需遍历 `getNodeActions` 返回值渲染按钮,显隐与点击行为均收敛于此 composable。
|
|
17
|
+
|
|
18
|
+
源码:`src/components/chat-content/flow-agent-content/use-flow-node-actions.ts`
|
|
19
|
+
|
|
20
|
+
## 函数签名
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
function useFlowNodeActions(options: {
|
|
24
|
+
/** resume 回调(与第三方审批取消同一回调,按 payload.operation 分流) */
|
|
25
|
+
onInterruptResume: Ref<OnInterruptResume | undefined>;
|
|
26
|
+
/** 打开节点详情侧栏(复用 useFlowTab 的能力) */
|
|
27
|
+
openNodeDetail: (task: BkFlowTask, node: BkFlowNode) => void;
|
|
28
|
+
}): {
|
|
29
|
+
getNodeActions: (task: FlowTaskVM, node: FlowNodeVM) => FlowNodeActionVM[];
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 返回值:FlowNodeActionVM
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
type FlowNodeActionId =
|
|
37
|
+
| 'detail'
|
|
38
|
+
| InterruptResumeOperation.FlowNodeRetry
|
|
39
|
+
| InterruptResumeOperation.FlowNodeSkip;
|
|
40
|
+
|
|
41
|
+
interface FlowNodeActionVM {
|
|
42
|
+
icon: Component;
|
|
43
|
+
id: FlowNodeActionId;
|
|
44
|
+
label: string;
|
|
45
|
+
run: () => void;
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| 字段 | 说明 |
|
|
50
|
+
| ------- | ------------------------------ |
|
|
51
|
+
| `icon` | 按钮图标组件 |
|
|
52
|
+
| `id` | 唯一标识,用于 `v-for` key |
|
|
53
|
+
| `label` | 国际化文案 |
|
|
54
|
+
| `run` | 点击执行(详情或 resume) |
|
|
55
|
+
|
|
56
|
+
## 操作显隐规则
|
|
57
|
+
|
|
58
|
+
| 操作 | `id` | 显隐条件 | 点击行为 |
|
|
59
|
+
| ---- | ------------------ | ------------------------------------------ | --------------------------------------------- |
|
|
60
|
+
| 重试 | `flow_node_retry` | `convergedState === 'failed'` 且 `retryable` | 调用 `onInterruptResume`,**不传** `interrupt` |
|
|
61
|
+
| 跳过 | `flow_node_skip` | `convergedState === 'failed'` 且 `skippable` | 同上 |
|
|
62
|
+
| 详情 | `detail` | 始终(Share 模式由上层组件隐藏整组) | 调用 `openNodeDetail(task.raw, node.raw)` |
|
|
63
|
+
|
|
64
|
+
展示顺序:重试 → 跳过 → 详情。
|
|
65
|
+
|
|
66
|
+
## resume 负载格式
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// 重试
|
|
70
|
+
onInterruptResume?.({
|
|
71
|
+
operation: InterruptResumeOperation.FlowNodeRetry,
|
|
72
|
+
payload: { node_id: node.id, task_id: task.task_id },
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// 跳过
|
|
76
|
+
onInterruptResume?.({
|
|
77
|
+
operation: InterruptResumeOperation.FlowNodeSkip,
|
|
78
|
+
payload: { node_id: node.id, task_id: task.task_id },
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 使用示例
|
|
83
|
+
|
|
84
|
+
`FlowAgentContent` 内部用法(业务侧通常通过 `MessageRender` 传入 `onInterruptResume`,无需直接调用本 composable):
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { toRef } from 'vue';
|
|
88
|
+
import { useFlowNodeActions } from '@blueking/chat-x';
|
|
89
|
+
// 或相对路径:'./use-flow-node-actions'
|
|
90
|
+
|
|
91
|
+
const { getNodeActions } = useFlowNodeActions({
|
|
92
|
+
onInterruptResume: toRef(props, 'onInterruptResume'),
|
|
93
|
+
openNodeDetail,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// 模板中
|
|
97
|
+
// v-for="action in getNodeActions(task, node)" :key="action.id"
|
|
98
|
+
// @click.stop="action.run()"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 扩展新操作
|
|
102
|
+
|
|
103
|
+
在 `RESUME_ACTION_DEFS` 注册表中追加一项即可,需声明 `visible` 与 `operation` 枚举:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const RESUME_ACTION_DEFS: FlowNodeResumeActionDef[] = [
|
|
107
|
+
// 现有:重试、跳过
|
|
108
|
+
{
|
|
109
|
+
icon: MyIcon,
|
|
110
|
+
id: InterruptResumeOperation.MyNewOp, // 需先在 InterruptResumeOperation 扩展
|
|
111
|
+
label: () => t('新操作'),
|
|
112
|
+
visible: node => /* 自定义显隐 */,
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
同时在 `interrupt.ts` 扩展 `InterruptResumeOperation` 与 `FlowNodeResume` 联合类型。
|
|
118
|
+
|
|
119
|
+
## 关联文档
|
|
120
|
+
|
|
121
|
+
- [FlowAgentContent 执行内容](/components/agent/flow-agent-content) — 消费方组件
|
|
122
|
+
- [中断类型 Interrupt](/types/interrupt) — `InterruptResumeOperation`、`FlowNodeResume`、`OnInterruptResume`
|
|
123
|
+
- [ActivityMessage 活动消息](/components/message/activity-message) — `onInterruptResume` 透传链路
|
|
124
|
+
- [MessageRender 消息渲染器](/components/message/message-render) — 顶层透传入口
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<!-- AI SUMMARY -->
|
|
2
|
+
## 快速了解
|
|
3
|
+
|
|
4
|
+
useFullScreen 将目标元素(或 document.documentElement)以浏览器原生全屏展示。 模块加载时一次性嗅探 requestFullscreen / webkitRequestFullscreen,返回 isSupported、只读 isFullScreen 与 enter/exit/toggle。 监听 fullscreenchange 同步 ESC 等外部退出;ChatContainer 侧栏全屏按钮使用此 composable。
|
|
5
|
+
|
|
6
|
+
### 关联组件
|
|
7
|
+
- **chat-container** — 侧栏 .ai-full-screen-wrapper 全屏切换
|
|
8
|
+
- **tool-btn** — 全屏按钮通过插槽渲染 FullScreenIcon
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
<!-- FULL DOC -->
|
|
12
|
+
|
|
13
|
+
# useFullScreen 全屏控制
|
|
14
|
+
|
|
15
|
+
> **分类**:composable
|
|
16
|
+
|
|
17
|
+
基于浏览器原生 Fullscreen API 的全屏控制组合式函数。模块加载时一次性嗅探标准 API 与 `webkit` 前缀(兼容旧版 Safari),在组件作用域销毁时自动移除事件监听。
|
|
18
|
+
|
|
19
|
+
## 工作原理
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
useFullScreen(target?)
|
|
23
|
+
│
|
|
24
|
+
├── resolveFullscreenApi()(模块级,仅执行一次)
|
|
25
|
+
│ requestFullscreen / webkitRequestFullscreen
|
|
26
|
+
│
|
|
27
|
+
├── isSupported = !!fullscreenApi
|
|
28
|
+
├── isFullScreen(readonly shallowRef,与浏览器真实状态同步)
|
|
29
|
+
│
|
|
30
|
+
├── enter() → target.requestFullscreen()
|
|
31
|
+
├── exit() → document.exitFullscreen()
|
|
32
|
+
├── toggle() → isFullScreen ? exit() : enter()
|
|
33
|
+
│
|
|
34
|
+
└── document.addEventListener(fullscreenchange, syncState)
|
|
35
|
+
syncState:指定 target 时,仅当 fullscreenElement === target 视为全屏
|
|
36
|
+
onScopeDispose 时移除监听
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **注意**:`enter()` 可能因缺少用户手势等原因被浏览器拒绝,内部会静默捕获异常,避免未处理的 Promise rejection。
|
|
40
|
+
|
|
41
|
+
## 基础用法
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<div>
|
|
46
|
+
<div ref="panelRef" class="demo-panel">
|
|
47
|
+
<p>可全屏展示的面板内容</p>
|
|
48
|
+
</div>
|
|
49
|
+
<button :disabled="!isSupported" @click="enter">进入全屏</button>
|
|
50
|
+
<button :disabled="!isFullScreen" @click="exit">退出全屏</button>
|
|
51
|
+
<span>当前状态:{{ isFullScreen ? '全屏' : '窗口' }}</span>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup lang="ts">
|
|
56
|
+
import { useTemplateRef } from 'vue';
|
|
57
|
+
import { useFullScreen } from '@blueking/chat-x';
|
|
58
|
+
|
|
59
|
+
const panelRef = useTemplateRef<HTMLElement>('panelRef');
|
|
60
|
+
const { isSupported, isFullScreen, enter, exit } = useFullScreen(panelRef);
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 在 ChatContainer 中的使用
|
|
65
|
+
|
|
66
|
+
`ChatContainer` 将侧栏包裹在 `.ai-full-screen-wrapper` 中,通过 `useFullScreen(fullScreenRef)` 控制侧栏全屏;Tab 栏 `#setting` 插槽内的 `ToolBtn` 使用自定义插槽渲染 `FullScreenIcon` / `UnFullScreenIcon`。
|
|
67
|
+
|
|
68
|
+
详见 [ChatContainer 侧栏全屏](../components/molecular/chat-container.md#侧栏全屏)。
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### 参数
|
|
73
|
+
|
|
74
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
75
|
+
| ------ | ---- | ------ | ---- |
|
|
76
|
+
| target | `MaybeRef<HTMLElement \| null>` | — | 需要全屏的目标元素;省略时回退到 `document.documentElement` |
|
|
77
|
+
|
|
78
|
+
### 返回值
|
|
79
|
+
|
|
80
|
+
| 属性名 | 类型 | 说明 |
|
|
81
|
+
| ------ | ---- | ---- |
|
|
82
|
+
| isSupported | `boolean` | 当前环境是否支持 Fullscreen API(SSR 或不支持时为 `false`) |
|
|
83
|
+
| isFullScreen | `Readonly<ShallowRef<boolean>>` | 只读响应式全屏状态;与浏览器真实状态同步(含 ESC 退出) |
|
|
84
|
+
| enter | `() => Promise<void>` | 进入全屏;已全屏或不受支持时无操作 |
|
|
85
|
+
| exit | `() => Promise<void>` | 退出全屏;当前无全屏元素时无操作 |
|
|
86
|
+
| toggle | `() => void` | 切换全屏状态 |
|
|
87
|
+
|
|
88
|
+
## 类型定义
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { useFullScreen } from '@blueking/chat-x';
|
|
92
|
+
import type { MaybeRef, Readonly, ShallowRef } from 'vue';
|
|
93
|
+
|
|
94
|
+
type UseFullScreenReturn = {
|
|
95
|
+
isSupported: boolean;
|
|
96
|
+
isFullScreen: Readonly<ShallowRef<boolean>>;
|
|
97
|
+
enter: () => Promise<void>;
|
|
98
|
+
exit: () => Promise<void>;
|
|
99
|
+
toggle: () => void;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// 调用签名
|
|
103
|
+
declare function useFullScreen(target?: MaybeRef<HTMLElement | null>): UseFullScreenReturn;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 使用场景
|
|
107
|
+
|
|
108
|
+
- `ChatContainer` 侧栏执行情况 / 自定义 Tab 区域全屏查看
|
|
109
|
+
- 任意需要将局部 DOM 区域以浏览器原生全屏展示的交互面板
|
|
110
|
+
|
|
111
|
+
## 关联组件
|
|
112
|
+
|
|
113
|
+
- [ChatContainer](../components/molecular/chat-container.md) — 内置侧栏全屏按钮
|
|
114
|
+
- [ToolBtn](../components/atomic/tool-btn.md) — 全屏按钮自定义插槽
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.0.0",
|
|
3
|
-
"generatedAt": "2026-06-
|
|
3
|
+
"generatedAt": "2026-06-09T06:41:01.574Z",
|
|
4
4
|
"domains": {
|
|
5
5
|
"setup": {
|
|
6
6
|
"label": "对话搭建",
|
|
@@ -1539,6 +1539,38 @@
|
|
|
1539
1539
|
],
|
|
1540
1540
|
"docFile": "docs/use-custom-tab.md"
|
|
1541
1541
|
},
|
|
1542
|
+
{
|
|
1543
|
+
"name": "useFlowNodeActions",
|
|
1544
|
+
"slug": "use-flow-node-actions",
|
|
1545
|
+
"kind": "composable",
|
|
1546
|
+
"description": "聚合 FlowAgent 节点行尾操作(详情 / 重试 / 跳过)为声明式视图模型列表,显隐与 resume 回调收敛于此。",
|
|
1547
|
+
"aiSummary": "useFlowNodeActions 接收 onInterruptResume 与 openNodeDetail,返回 getNodeActions(task, node)。 失败节点按 retryable/skippable 展示重试/跳过,详情恒在末尾;点击 resume 时不传 interrupt。",
|
|
1548
|
+
"relatedComponents": [
|
|
1549
|
+
{
|
|
1550
|
+
"slug": "flow-agent-content",
|
|
1551
|
+
"relation": "FlowAgentContent 内部消费,驱动节点行尾按钮组渲染"
|
|
1552
|
+
}
|
|
1553
|
+
],
|
|
1554
|
+
"docFile": "docs/use-flow-node-actions.md"
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
"name": "useFullScreen",
|
|
1558
|
+
"slug": "use-full-screen",
|
|
1559
|
+
"kind": "composable",
|
|
1560
|
+
"description": "基于浏览器原生 Fullscreen API 的全屏控制组合式函数,自动嗅探标准与 WebKit 前缀,状态与 ESC 退出保持同步。",
|
|
1561
|
+
"aiSummary": "useFullScreen 将目标元素(或 document.documentElement)以浏览器原生全屏展示。 模块加载时一次性嗅探 requestFullscreen / webkitRequestFullscreen,返回 isSupported、只读 isFullScreen 与 enter/exit/toggle。 监听 fullscreenchange 同步 ESC 等外部退出;ChatContainer 侧栏全屏按钮使用此 composable。",
|
|
1562
|
+
"relatedComponents": [
|
|
1563
|
+
{
|
|
1564
|
+
"slug": "chat-container",
|
|
1565
|
+
"relation": "侧栏 .ai-full-screen-wrapper 全屏切换"
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
"slug": "tool-btn",
|
|
1569
|
+
"relation": "全屏按钮通过插槽渲染 FullScreenIcon"
|
|
1570
|
+
}
|
|
1571
|
+
],
|
|
1572
|
+
"docFile": "docs/use-full-screen.md"
|
|
1573
|
+
},
|
|
1542
1574
|
{
|
|
1543
1575
|
"name": "useGlobalConfig",
|
|
1544
1576
|
"slug": "use-global-config",
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 蓝鲸行内富文本(安全样式)扩展。
|
|
3
|
+
*
|
|
4
|
+
* 语法(与 HTML 无关,不开启 markdown-it `html`):
|
|
5
|
+
*
|
|
6
|
+
* ::bk{ 属性列表 } 正文内容 :/bk::
|
|
7
|
+
*
|
|
8
|
+
* - 属性列表:写在 `{}` 内,使用 `;` 分隔,每项为 `键=值` 或 `键:值`(等号与冒号等价)。
|
|
9
|
+
* - 正文:支持行内 Markdown(加粗、链接、行内代码等),由 markdown-it 再次 tokenize。
|
|
10
|
+
* - 结束标记固定为 `:/bk::`,请勿在正文中使用该字面量。
|
|
11
|
+
*
|
|
12
|
+
* 支持的键(仅生成固定白名单 style):
|
|
13
|
+
* - `color` / `c`:颜色(#rgb / #rrggbb 或 CSS 命名色)
|
|
14
|
+
* - `background-color`:背景色,规则同 color
|
|
15
|
+
* - `font-size`:字号,如 `14px`(限制 1-72px)
|
|
16
|
+
* - `bold`:加粗
|
|
17
|
+
* - `italic`:斜体
|
|
18
|
+
*/
|
|
19
|
+
import type { PluginSimple } from '../markdown-it';
|
|
20
|
+
export declare const markdownItBkInlineStyle: PluginSimple;
|
package/dist/types/custom.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Component } from 'vue';
|
|
|
2
2
|
export type CustomBkFlowTab = CustomTab<CustomBkFlowTabData>;
|
|
3
3
|
export type CustomBkFlowTabData = CustomTabData<{
|
|
4
4
|
data?: Partial<NodeDetailData>;
|
|
5
|
+
has_confidence?: boolean;
|
|
5
6
|
loading?: boolean;
|
|
6
7
|
node_id?: string;
|
|
7
8
|
node_name?: string;
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -21,3 +21,9 @@ export declare const resourceTypeMap: {
|
|
|
21
21
|
};
|
|
22
22
|
export type ResourceType = keyof typeof resourceTypeMap;
|
|
23
23
|
export declare const noop: () => void;
|
|
24
|
+
export interface ISkillListItem {
|
|
25
|
+
description: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
skill_code: string;
|
|
28
|
+
skill_name: string;
|
|
29
|
+
}
|
package/dist/types/input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type tagSchema } from '../components/chat-input/ai-slash-input/constants';
|
|
2
1
|
import type { BinaryInputContent } from '../ag-ui/types/contents';
|
|
2
|
+
import type { tagSchema } from '../components/chat-input/ai-slash-input/constants';
|
|
3
3
|
import type { InferDoc } from '../edix';
|
|
4
4
|
export declare const MessageState: {
|
|
5
5
|
readonly ACTIVE: "active";
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ToolIconsMap } from '../icons/tools';
|
|
2
2
|
import type { TippyOptions } from 'vue-tippy';
|
|
3
3
|
export declare enum MessageToolsStatus {
|
|
4
4
|
Disabled = "disabled",// 禁用
|
|
5
5
|
Hidden = "hidden"
|
|
6
6
|
}
|
|
7
|
-
export type AITippyProps = Partial<Pick<TippyOptions, 'appendTo' | 'zIndex'>>;
|
|
7
|
+
export type AITippyProps = Partial<Pick<TippyOptions, 'appendTo' | 'placement' | 'zIndex'>>;
|
|
8
8
|
export interface IToolBtn {
|
|
9
9
|
description?: string;
|
|
10
|
-
id
|
|
10
|
+
id?: keyof typeof ToolIconsMap;
|
|
11
11
|
name?: string;
|
|
12
12
|
}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/utils.d.ts
CHANGED