From 3c7e5ff3b6e6a85603c55cbb8c8e3110fa6fe423 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 29 Oct 2025 18:26:24 +0800 Subject: [PATCH] perf: Variable aggregation node adds sorting and modifies some styling issues --- .../layout-header/avatar/APIKeyDialog.vue | 2 +- .../lang/en-US/views/application-workflow.ts | 2 +- .../lang/zh-CN/views/application-workflow.ts | 2 +- .../zh-Hant/views/application-workflow.ts | 2 +- ui/src/styles/component.scss | 20 ++++ ui/src/views/document/tag/TagDrawer.vue | 13 ++- ui/src/workflow/common/data.ts | 15 ++- .../workflow/nodes/condition-node/index.vue | 22 +---- .../nodes/variable-aggregation-node/index.vue | 97 +++++++++++-------- 9 files changed, 104 insertions(+), 71 deletions(-) diff --git a/ui/src/layout/layout-header/avatar/APIKeyDialog.vue b/ui/src/layout/layout-header/avatar/APIKeyDialog.vue index edd21337b..637bcdeae 100644 --- a/ui/src/layout/layout-header/avatar/APIKeyDialog.vue +++ b/ui/src/layout/layout-header/avatar/APIKeyDialog.vue @@ -126,7 +126,7 @@ function changeState(bool: boolean, row: any) { const obj = { is_active: bool, } - const str = bool ? t('common.enabled') : t('common.disabled') + const str = bool ? t('common.status.enabled') : t('common.status.disabled') systemKeyApi.putAPIKey(row.id, obj, loading).then((res) => { MsgSuccess(str) getApiKeyList() diff --git a/ui/src/locales/lang/en-US/views/application-workflow.ts b/ui/src/locales/lang/en-US/views/application-workflow.ts index 7b9b4673a..1043c8c85 100644 --- a/ui/src/locales/lang/en-US/views/application-workflow.ts +++ b/ui/src/locales/lang/en-US/views/application-workflow.ts @@ -259,7 +259,7 @@ You are a master of problem optimization, adept at accurately inferring user int }, variableAggregationNode: { label: 'Variable Aggregation', - text: 'Perform aggregation processing on the outputs of multiple branches', + text: 'Aggregate variables of each group according to the aggregation strategy', Strategy: 'Aggregation Strategy', placeholder: 'Return the first non-null value of each group', placeholder1: 'Return the set of variables for each group', diff --git a/ui/src/locales/lang/zh-CN/views/application-workflow.ts b/ui/src/locales/lang/zh-CN/views/application-workflow.ts index 42577e8b3..b0124fcde 100644 --- a/ui/src/locales/lang/zh-CN/views/application-workflow.ts +++ b/ui/src/locales/lang/zh-CN/views/application-workflow.ts @@ -260,7 +260,7 @@ export default { }, variableAggregationNode: { label: '变量聚合', - text: '对多个分支的输出进行聚合处理', + text: '按聚合策略聚合每组的变量', Strategy: '聚合策略', placeholder: '返回每组的第一个非空值', placeholder1: '返回每组变量的集合', diff --git a/ui/src/locales/lang/zh-Hant/views/application-workflow.ts b/ui/src/locales/lang/zh-Hant/views/application-workflow.ts index e6e759908..fd89f347e 100644 --- a/ui/src/locales/lang/zh-Hant/views/application-workflow.ts +++ b/ui/src/locales/lang/zh-Hant/views/application-workflow.ts @@ -259,7 +259,7 @@ export default { }, variableAggregationNode: { label: '變量聚合', - text: '對多個分支的輸出進行聚合處理', + text: '按聚合策略聚合每組的變量', Strategy: '聚合策略', placeholder: '返回每組的第一個非空值', placeholder1: '返回每組變量的集合', diff --git a/ui/src/styles/component.scss b/ui/src/styles/component.scss index 33b58b5f8..b57e9def1 100644 --- a/ui/src/styles/component.scss +++ b/ui/src/styles/component.scss @@ -262,3 +262,23 @@ padding: 4px 16px 12px 12px; } } +// 拖拽排序 +.drag-card.no-drag { + .handle { + .handle-img { + display: none; + } + } +} +.drag-card:not(.no-drag) { + .handle { + .handle-img { + display: none; + } + &:hover { + .handle-img { + display: block; + } + } + } +} diff --git a/ui/src/views/document/tag/TagDrawer.vue b/ui/src/views/document/tag/TagDrawer.vue index 4855c2e91..90b96db41 100644 --- a/ui/src/views/document/tag/TagDrawer.vue +++ b/ui/src/views/document/tag/TagDrawer.vue @@ -259,11 +259,18 @@ function editTagValue(row: any) { } function delTagValue(row: any) { - loadSharedApi({ type: 'knowledge', systemType: apiType.value }) - .delTag(id, row.id, 'one') + MsgConfirm(t('views.document.tag.deleteConfirm') + row.value, t('views.document.tag.deleteTip'), { + confirmButtonText: t('common.delete'), + confirmButtonClass: 'danger', + }) .then(() => { - getList() + loadSharedApi({ type: 'knowledge', systemType: apiType.value }) + .delTag(id, row.id, 'one') + .then(() => { + getList() + }) }) + .catch(() => {}) } function getList() { diff --git a/ui/src/workflow/common/data.ts b/ui/src/workflow/common/data.ts index dc6baf24a..8587cc263 100644 --- a/ui/src/workflow/common/data.ts +++ b/ui/src/workflow/common/data.ts @@ -636,7 +636,7 @@ export const menuNodes = [ }, { label: t('views.knowledge.title'), - list: [searchKnowledgeNode, searchDocumentNode, rerankerNode], + list: [searchKnowledgeNode, searchDocumentNode, rerankerNode, documentExtractNode], }, { label: t('views.applicationWorkflow.nodes.classify.businessLogic'), @@ -653,7 +653,7 @@ export const menuNodes = [ }, { label: t('views.applicationWorkflow.nodes.classify.other'), - list: [mcpNode, documentExtractNode, toolNode], + list: [mcpNode, toolNode], }, ] export const applicationLoopMenuNodes = [ @@ -674,7 +674,7 @@ export const applicationLoopMenuNodes = [ }, { label: t('views.knowledge.title'), - list: [searchKnowledgeNode, searchDocumentNode, rerankerNode], + list: [searchKnowledgeNode, searchDocumentNode, rerankerNode, documentExtractNode], }, { label: t('views.applicationWorkflow.nodes.classify.businessLogic'), @@ -682,11 +682,16 @@ export const applicationLoopMenuNodes = [ }, { label: t('views.applicationWorkflow.nodes.classify.dataProcessing', '数据处理'), - list: [variableAssignNode, variableSplittingNode, parameterExtractionNode, variableAggregationNode], + list: [ + variableAssignNode, + variableSplittingNode, + parameterExtractionNode, + variableAggregationNode, + ], }, { label: t('views.applicationWorkflow.nodes.classify.other'), - list: [mcpNode, documentExtractNode, toolNode], + list: [mcpNode, toolNode], }, ] diff --git a/ui/src/workflow/nodes/condition-node/index.vue b/ui/src/workflow/nodes/condition-node/index.vue index 78c20c7ee..6d8755f61 100644 --- a/ui/src/workflow/nodes/condition-node/index.vue +++ b/ui/src/workflow/nodes/condition-node/index.vue @@ -11,7 +11,7 @@ { }) diff --git a/ui/src/workflow/nodes/variable-aggregation-node/index.vue b/ui/src/workflow/nodes/variable-aggregation-node/index.vue index 7f9071a79..b2fe764fc 100644 --- a/ui/src/workflow/nodes/variable-aggregation-node/index.vue +++ b/ui/src/workflow/nodes/variable-aggregation-node/index.vue @@ -42,8 +42,8 @@
{{ group.label }} -
- +
+
- -
- - - - - - - - - - - - -
- + +
+ + + + + + + + + + + + + +
+
{{ $t('common.add') }} @@ -116,6 +123,7 @@ import { isLastNode } from '@/workflow/common/data' import { t } from '@/locales' import { randomId } from '@/utils/common' import { MsgError } from '@/utils/message' +import { VueDraggable } from 'vue-draggable-plus' const props = defineProps<{ nodeModel: any }>() const VariableAggregationRef = ref() @@ -241,6 +249,17 @@ const validate = async () => { }) } +function onEnd(event: any, gIndex: number) { + const { oldIndex, newIndex } = event + if (oldIndex === undefined || newIndex === undefined) return + const list = cloneDeep(props.nodeModel.properties.node_data.group_list[gIndex].variable_list) + const newInstance = { ...list[oldIndex] } + const oldInstance = { ...list[newIndex] } + list[newIndex] = newInstance + list[oldIndex] = oldInstance + set(props.nodeModel.properties.node_data.group_list[gIndex], 'variable_list', list) +} + onMounted(() => { if (typeof props.nodeModel.properties.node_data?.is_result === 'undefined') { if (isLastNode(props.nodeModel)) {