Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/assets/iconfont.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions ui/src/assets/workflow/icon_document-split.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions ui/src/assets/workflow/icon_knowledge-base.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ui/src/router/ROUTE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ System 共享资源页面:
component: () => import('@/views/system/SystemView.vue'),
meta: {
title: '系统设置',
icon: 'icon_setting_outlined',
icon: 'icon_setting',
order: 60,
},
}
Expand Down
6 changes: 3 additions & 3 deletions ui/src/router/admin/system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const systemRoutes: RouteRecordRaw = {
path: 'resource',
name: 'system-resource',
redirect: { name: 'system-resource-applications' },
meta: { title: '资源管理', icon: 'icon-setting', order: 20, resourceScope: 'system-resource' },
meta: { title: '资源管理', icon: 'icon_setting', order: 20, resourceScope: 'system-resource' },
children: [
{ path: 'applications', name: 'system-resource-applications', component: () => import('@/views/system/SystemView.vue'), meta: { title: '智能体', order: 10 } },
{ path: 'knowledge', name: 'system-resource-knowledge', component: () => import('@/views/system/SystemView.vue'), meta: { title: '知识库', order: 20 } },
Expand All @@ -82,7 +82,7 @@ export const systemRoutes: RouteRecordRaw = {
path: 'share',
name: 'system-share',
redirect: { name: 'system-shared-knowledge' },
meta: { title: '共享资源', icon: 'icon-setting', order: 30, resourceScope: 'system-shared' },
meta: { title: '共享资源', icon: 'icon_setting', order: 30, resourceScope: 'system-shared' },
children: [
{ path: 'knowledge', name: 'system-shared-knowledge', component: () => import('@/views/system/SystemView.vue'), meta: { title: '知识库', order: 10 } },
{ path: 'models', name: 'system-shared-models', component: () => import('@/views/system/shared-resources/SharedModelview.vue'), meta: { title: '模型', order: 20 } },
Expand Down Expand Up @@ -110,7 +110,7 @@ export const systemRoutes: RouteRecordRaw = {
path: 'settings',
name: 'system-settings',
redirect: { name: 'system-login-authentication' },
meta: { title: '系统设置', icon: 'icon-setting', order: 50 },
meta: { title: '系统设置', icon: 'icon_setting', order: 50 },
children: [
{
path: 'authentication',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/router/admin/workspace/modules/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const applicationRoutes: RouteRecordRaw[] = [
path: 'setting',
name: 'workspace-application-simple-setting',
component: () => import('@/views/application-detail/setting/SimpleSettingView.vue'),
meta: { title: '设置', icon: 'icon-setting', activeIcon: 'icon_setting_filled', order: 20 },
meta: { title: '设置', icon: 'icon_setting', activeIcon: 'icon_setting_filled', order: 20 },
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/styles/element-plus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@
max-width: 115px;
padding: 0 6px;
font-weight: 400 !important;
line-height: 21px;
line-height: 18px;
&__content {
overflow: hidden;
text-overflow: ellipsis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function handleSettingApplication(event: MouseEvent) {

<template>
<MkDropdownItem @click="handleSettingApplication">
<template #icon><MkIcon name="icon-setting" /></template>
<template #icon><MkIcon name="icon_setting" /></template>
<span>{{ label }}</span>
</MkDropdownItem>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function handleOpenWorkflow(event: MouseEvent) {

<template>
<MkDropdownItem @click="handleOpenWorkflow">
<template #icon><MkIcon name="icon-setting" /></template>
<template #icon><MkIcon name="icon_setting" /></template>
<span>{{ label }}</span>
</MkDropdownItem>
</template>
23 changes: 22 additions & 1 deletion ui/src/workflow-canvas/WORKFLOW_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ AI 对话、意图识别、问题优化、参数提取、图片理解、视频
组件通过 `submit(data, index?)` 提交,节点写回后
调用 `close()`。新增与编辑参数继续按来源重置参数值,保留旧节点在流程末尾时的返回内容兼容逻辑。

工作流工具节点在入口维护输入参数与返回内容,参数定义通过工作流 Store 强制刷新工具详情,
按 `field` 保留已配置来源和值,同步输入、输出标题及最新输出名称;节点卸载后忽略旧响应。
输入参数保留引用与自定义两种来源,切换到引用时重置为空路径,自定义按数据类型初始化,
数组与字典复用 `JsonInput`。节点只在表单项声明必填规则,统一调用 `formRef.validate()`,
由输入组件触发表单项校验,不维护组件 Ref Map 或重复调用组件暴露的校验方法;来源下拉维护锚点保护。
旧节点缺少返回内容开关时继续沿用无后继节点即开启的兼容规则。

变量拆分节点的 `VariableFieldTable` 通过 `v-model` 接收 `VariableField[]`,只负责列表增删改、
重名检查和编辑弹窗,不接收节点模型或读写 `node_data`。节点入口在列表写回时同步输出字段并
清理下游失效引用;字段类型由该组件目录的 `types.ts` 统一定义。
Expand All @@ -175,6 +182,12 @@ AI 对话、意图识别、问题优化、参数提取、图片理解、视频
节点入口深拷贝写回列表并发送原有字段刷新事件,保留显隐条件引用校验。用户输入与接口传参继续
交叉检查参数重名;`UserInputSettingDialog` 独立维护直接展示参数设置,删除字段时由表格清理对应设置。

工具基本信息节点的输入、输出参数表格通过 `v-model` 编辑类型化字段列表,通过 `v-model:config`
编辑标题配置。字段弹窗通过 `submit(data, index?)` 提交,表格完成重名检查与写回后关闭弹窗;
标题弹窗通过 `submit(config)` 提交。节点入口统一深拷贝写回 `properties` 顶层的原有字段与标题协议,
增删、编辑及排序后刷新工具开始节点的全局变量并清空下游字段缓存。工具开始节点保留
`global` 输入与 `output` 输出分组、旧字段的 `name` 回退和全局变量引用复制。

基本信息节点的 `component/LongTermSetting.vue` 同时封装长期记忆设置按钮与弹窗,
通过 `v-model` 接收 `LongTermSetting`,模型与供应商选项由节点入口传入。节点入口根据长期记忆
开关挂载组件;打开时深拷贝配置为草稿,校验通过并保存后仅合并长期记忆配置,取消不修改节点。
Expand Down Expand Up @@ -259,6 +272,14 @@ Break 和 Continue 节点在各自入口维护 `condition`、`condition_list`
为真、不为真时隐藏比较值并跳过其必填校验,不改写已保存的比较值。节点级校验统一调用外层表单,
比较符和逻辑下拉保持 `teleported="false"`,通过 `createAnchorGuard()` 保护锚点。

文档分段节点使用 `WorkflowNodeModel` / `WorkflowNodeView` 注册,在入口维护智能、高级和问答对
三种策略。保留 `referencing` 来源协议、子分块长度默认 256、分段长度默认 4096,以及高级策略和
问答对策略下的字段显隐。文档与当前可见的配置引用仅在表单项声明数组必填规则,
由 `NodeCascader` 触发表单项校验,节点统一调用 `formRef.validate()`,不维护引用组件校验 Ref;
切换来源或策略保留字段值并清理校验和浮层保护。`constant.ts` 保存与后端
`DocumentSerializers.SplitPattern` 一致的固定标识选项,不依赖旧知识库路由或旧版动态 API,
仍支持按选择顺序递归分割和添加自定义标识。

### 节点列表排序

`MkFormList` 和 `MkTable` 均为全局自动注册组件,节点模板直接使用,无需手动导入;
Expand Down Expand Up @@ -356,7 +377,7 @@ MkFormList 的排序、增删均以 `cloneDeep` 回写;MkTable 保留普通行

- 已实现并注册:基本信息、开始、AI 对话、意图识别、问题优化、语音转文本、文本转语音、图片生成、
图片理解、文生视频、图生视频、视频理解、知识库检索、判断器、指定回复、智能体、自定义工具和
工具库工具、工具工作流、MCP、文档内容提取、多路召回和文档标签检索,以及参数提取、表单收集、
工具库工具、工具工作流、MCP、文档内容提取、文档分段、多路召回和文档标签检索,以及参数提取、表单收集、
变量赋值、变量聚合、变量拆分、循环、循环体、循环开始、Break、Continue、工具基本信息和工具开始节点。
- 知识库检索节点在入口维护检索范围、参数摘要和问题表单,参数设置按钮与弹窗统一封装在
`component/SearchSetting.vue`,通过 `v-model` 接收检索参数,仅在校验通过并保存后深拷贝回写;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow-canvas/component/ThinkingSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function resetData() {

<template>
<el-button text type="primary" @click="open">
<MkIcon name="icon-setting" />
<MkIcon name="icon_setting" />
</el-button>
<MkDialog v-model="visible" title="设置" @closed="resetData">
<template #subtitle> 请根据模型返回的思考标签设置,标签中间的内容将会认定为思考过程</template>
Expand Down
25 changes: 12 additions & 13 deletions ui/src/workflow-canvas/config/node-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const toolBaseNode = {
export const toolStartNode = {
id: WorkflowNodeType.ToolStartNode,
type: WorkflowNodeType.ToolStartNode,
x: 946,
x: 846,
y: 2600,
text: '',
properties: {
Expand Down Expand Up @@ -377,6 +377,16 @@ export const toolLibNode = {
properties: { stepName: '工具节点', config: { fields: [{ label: '结果', value: 'result' }] } },
}

/**
* 工作流工具配置数据
*/
export const toolWorkflowLibNode = {
type: WorkflowNodeType.ToolWorkflowLib,
text: '工作流工具',
label: '工作流工具',
properties: { stepName: '工作流工具', config: { fields: [] } },
}

/* 循环节点 */

export const loopNode = {
Expand Down Expand Up @@ -457,23 +467,12 @@ export const loopBreakNode = {
properties: { width: 600, stepName: 'Break', config: { fields: [] } },
}

/**
* 工作流工具配置数据
*/
export const toolWorkflowLibNode = {
type: WorkflowNodeType.ToolWorkflowLib,
text: '工作流工具',
label: '工作流工具',
properties: { stepName: '工作流工具', config: { fields: [] } },
}

/* 文档分段 */
export const documentSplitNode = {
type: WorkflowNodeType.DocumentSplitNode,
text: '按分段策略拆分输入文档内容,输出分段文本列表',
label: '文档分段',
height: 252,
properties: { width: 500, stepName: '文档分段', config: { fields: [{ label: '分段列表', value: 'paragraph_list' }] } },
properties: { stepName: '文档分段', config: { fields: [{ label: '分段列表', value: 'paragraph_list' }] } },
}

export const dataSourceLocalNode = {
Expand Down
6 changes: 6 additions & 0 deletions ui/src/workflow-canvas/icons/document-split-node-icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<el-avatar shape="square">
<img src="@/assets/workflow/icon_document-split.svg" style="width: 64%" alt="" />
</el-avatar>
</template>
<script setup lang="ts"></script>
6 changes: 6 additions & 0 deletions ui/src/workflow-canvas/icons/tool-base-node-icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<el-avatar shape="square" class="bg-warning!">
<img src="@/assets/workflow/icon_knowledge-base.svg" style="width: 63%" alt="" />
</el-avatar>
</template>
<script setup lang="ts"></script>
6 changes: 6 additions & 0 deletions ui/src/workflow-canvas/icons/tool-start-node-icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<el-avatar shape="square" style="background: #d136d1">
<img src="@/assets/workflow/icon_start.svg" style="width: 75%" alt="" />
</el-avatar>
</template>
<script setup lang="ts"></script>
6 changes: 6 additions & 0 deletions ui/src/workflow-canvas/icons/tool-workflow-lib-node-icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<el-avatar shape="square" class="bg-success!">
<img src="@/assets/workflow/logo_workflow.svg" style="width: 60%" alt="" />
</el-avatar>
</template>
<script setup lang="ts"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function resetData() {

<template>
<el-button text type="primary" @click="open">
<MkIcon name="icon-setting" />
<MkIcon name="icon_setting" />
</el-button>
<MkDialog v-model="visible" title="文件上传设置" @closed="resetData" align-center>
<el-form ref="formRef" :model="formData" :rules="rules" label-position="top" require-asterisk-position="right" @submit.prevent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function submit() {
<template>
<!-- 打开长期记忆设置 -->
<el-button text type="primary" @click="open">
<MkIcon name="icon-setting" />
<MkIcon name="icon_setting" />
</el-button>
<MkDialog v-model="visible" title="长期记忆设置" align-center>
<el-form ref="formRef" :model="formData" label-position="top" require-asterisk-position="right" @submit.prevent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function removeExposedField(field: string) {
<span>用户输入</span>
<div class="flex items-center">
<el-button text type="primary" title="用户输入设置" @click="settingDialogRef?.open(setting)">
<MkIcon name="icon-setting" />
<MkIcon name="icon_setting" />
</el-button>
<el-button text type="primary" @click="openFieldDialog()">
<MkIcon name="icon_add_outlined" />
Expand Down
55 changes: 55 additions & 0 deletions ui/src/workflow-canvas/nodes/document-split-node/constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 与后端 DocumentSerializers.SplitPattern 的固定标识保持一致;顺序由用户选择决定。
export const splitPatternOptions = [
{
label: '#',
value: '(?<=^)# .*|(?<=\\n)# .*',
},
{
label: '##',
value: '(?<=\\n)(?<!#)## (?!#).*|(?<=^)(?<!#)## (?!#).*',
},
{
label: '###',
value: '(?<=\\n)(?<!#)### (?!#).*|(?<=^)(?<!#)### (?!#).*',
},
{
label: '####',
value: '(?<=\\n)(?<!#)#### (?!#).*|(?<=^)(?<!#)#### (?!#).*',
},
{
label: '#####',
value: '(?<=\\n)(?<!#)##### (?!#).*|(?<=^)(?<!#)##### (?!#).*',
},
{
label: '######',
value: '(?<=\\n)(?<!#)###### (?!#).*|(?<=^)(?<!#)###### (?!#).*',
},
{
label: '-',
value: '(?<! )- .*',
},
{
label: '空格',
value: '(?<! ) (?! )',
},
{
label: '分号',
value: '(?<!;);(?!;)',
},
{
label: '逗号',
value: '(?<!,),(?!,)',
},
{
label: '句号',
value: '(?<!。)。(?!。)',
},
{
label: '回车',
value: '(?<!\\n)\\n(?!\\n)',
},
{
label: '空行',
value: '(?<!\\n)\\n\\n(?!\\n)',
},
]
18 changes: 18 additions & 0 deletions ui/src/workflow-canvas/nodes/document-split-node/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import DocumentSplitNode from './index.vue'
import { WorkflowNodeModel, WorkflowNodeView } from '@/workflow-canvas/core/workflow-node'
import { WorkflowNodeType } from '@/workflow-canvas/types'

class DocumentSplitNodeView extends WorkflowNodeView {
constructor(props: ConstructorParameters<typeof WorkflowNodeView>[0]) {
super(props, DocumentSplitNode)
}
}

class DocumentSplitNodeModel extends WorkflowNodeModel {
setAttributes() {
super.setAttributes()
this.width = 360
}
}

export default { type: WorkflowNodeType.DocumentSplitNode, model: DocumentSplitNodeModel, view: DocumentSplitNodeView }
Loading
Loading