fix: variable aggregation node style
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wangdan-fit2cloud 2025-10-29 11:29:14 +08:00
parent 52316895d4
commit a1898e837a
19 changed files with 131 additions and 143 deletions

View File

@ -72,13 +72,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -137,7 +137,7 @@ const default_ref_variables_value_rule = {
validator: (rule: any, value: any, callback: any) => {
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -183,7 +183,7 @@ const default_ref_variables_value_rule = {
console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -153,13 +153,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -192,7 +192,7 @@ const default_ref_variables_value_rule = {
console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -182,7 +182,7 @@ const default_ref_variables_value_rule = {
console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -144,13 +144,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -183,7 +183,7 @@ const default_ref_variables_value_rule = {
console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -143,13 +143,13 @@ const getModel = inject('getModel') as any
const assignment_method_option_list = computed(() => {
const option_list = [
{
label: t('dynamicsForm.AssignmentMethod.custom.label', '自定义'),
label: t('common.custom'),
value: 'custom',
},
]
if (getModel) {
option_list.push({
label: t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量'),
label: t('views.applicationWorkflow.variable.Referencing'),
value: 'ref_variables',
})
}
@ -182,7 +182,7 @@ const default_ref_variables_value_rule = {
console.log(value.length)
if (!(Array.isArray(value) && value.length > 1)) {
callback(
t('dynamicsForm.AssignmentMethod.ref_variables.label', '引用变量') + t('common.required'),
t('views.applicationWorkflow.variable.Referencing') + t('common.required'),
)
}

View File

@ -50,13 +50,14 @@ export default {
beautify: 'Auto-Arrange',
},
variable: {
label: 'Variable',
global: 'Global Variable',
Referencing: 'Referenced Variable',
ReferencingRequired: 'Referenced variable is required',
ReferencingError: 'Invalid referenced variable',
NoReferencing: 'Referenced variable does not exist',
placeholder: 'Please select a variable',
inputPlaceholder: 'Please enter variable',
loop: 'Loop Variable',
},
condition: {
title: 'Execution Condition',
@ -199,11 +200,7 @@ You are a master of problem optimization, adept at accurately inferring user int
replyNode: {
label: 'Specified Reply',
text: 'Specify reply content, referenced variables will be converted to strings for output',
content: 'Content',
replyContent: {
label: 'Reply Content',
reference: 'Reference Variable',
},
replyContent: 'Reply Content',
},
rerankerNode: {
label: 'Multi-path Recall',
@ -267,11 +264,11 @@ You are a master of problem optimization, adept at accurately inferring user int
placeholder: 'Return the first non-null value of each group',
placeholder1: 'Return the set of variables for each group',
group: {
placeholder: 'Please select a variable',
noneError: 'Name cannot be empty',
dupError: 'Name cannot be duplicated',
},
add: 'Add Group',
addGroup: 'Add Group',
editGroup: 'Edit Group',
},
mcpNode: {
label: 'MCP Node',
@ -421,7 +418,6 @@ You are a master of problem optimization, adept at accurately inferring user int
label: 'Loop Start',
loopIndex: 'Index',
loopItem: 'Loop Element',
loopVariable: 'Loop Variable',
},
loopBodyNode: {
label: 'Loop Body',
@ -445,7 +441,6 @@ You are a master of problem optimization, adept at accurately inferring user int
inputVariables: 'Input Variable',
addVariables: 'Add Variables',
editVariables: 'Edit Variables',
variablePlaceholder: 'Please enter variable',
variableListPlaceholder: 'Please add split variables',
expression: {
label: 'Expression',

View File

@ -123,7 +123,6 @@ export default {
label: '自定义',
},
ref_variables: {
label: '引用变量 ',
popover: '变量的值必须符合',
json_format: 'JSON 格式',
popover_label: '标签',

View File

@ -57,6 +57,7 @@ export default {
ReferencingError: '引用变量错误',
NoReferencing: '不存在的引用变量',
placeholder: '请选择变量',
inputPlaceholder: '请输入变量',
loop: '循环变量',
},
condition: {
@ -206,11 +207,7 @@ export default {
replyNode: {
label: '指定回复',
text: '指定回复内容,引用变量会转换为字符串进行输出',
content: '内容',
replyContent: {
label: '回复内容',
reference: '引用变量',
},
replyContent: '回复内容',
},
rerankerNode: {
label: '多路召回',
@ -268,11 +265,11 @@ export default {
placeholder: '返回每组的第一个非空值',
placeholder1: '返回每组变量的集合',
group: {
placeholder: '请选择变量',
noneError: '名称不能为空',
dupError: '名称不能重复',
},
add: '添加分组',
addGroup: '添加分组',
editGroup: '编辑分组',
},
variableAssignNode: {
label: '变量赋值',
@ -433,7 +430,6 @@ export default {
label: '循环开始',
loopIndex: '下标',
loopItem: '循环元素',
loopVariable: '循环变量',
},
loopBodyNode: {
label: '循环体',
@ -456,7 +452,6 @@ export default {
inputVariables: '输入变量',
addVariables: '添加变量',
editVariables: '编辑变量',
variablePlaceholder: '请输入变量',
variableListPlaceholder: '请添加拆分变量',
expression: {
label: '表达式',

View File

@ -50,13 +50,14 @@ export default {
beautify: '一鍵美化',
},
variable: {
label: '變量',
global: '全局變量',
Referencing: '引用變量',
ReferencingRequired: '引用變量必填',
ReferencingError: '引用變量錯誤',
NoReferencing: '不存在的引用變量',
placeholder: '請選擇變量',
inputPlaceholder: '請輸入變量',
loop: '循環變量',
},
condition: {
title: '執行條件',
@ -200,11 +201,7 @@ export default {
replyNode: {
label: '指定回覆',
text: '指定回覆內容,引用變量會轉換為字符串進行輸出',
content: '內容',
replyContent: {
label: '回覆內容',
reference: '引用變量',
},
replyContent: '回覆內容',
},
rerankerNode: {
label: '多路召回',
@ -267,11 +264,11 @@ export default {
placeholder: '返回每組的第一個非空值',
placeholder1: '返回每組變量的集合',
group: {
placeholder: '請選擇變量',
noneError: '名稱不能為空',
dupError: '名稱不能重複',
},
add: '新增分組',
addGroup: '添加分組',
editGroup: '編輯分組',
},
mcpNode: {
label: 'MCP 調用',
@ -414,7 +411,6 @@ export default {
label: '循環開始',
loopIndex: '下標',
loopItem: '循環元素',
loopVariable: '循環變量',
},
loopBodyNode: { label: '循環體', text: '循環體' },
loopContinueNode: {
@ -431,7 +427,6 @@ export default {
inputVariables: '輸入變量',
addVariables: '添加變量',
editVariables: '編輯變量',
variablePlaceholder: '請輸入變量',
variableListPlaceholder: '請添加折開變數',
expression: {
label: '表達式',

View File

@ -233,7 +233,7 @@ export const replyNode = {
config: {
fields: [
{
label: t('views.applicationWorkflow.nodes.replyNode.content'),
label: t('common.content'),
value: 'answer',
},
],

View File

@ -1,7 +1,7 @@
<template>
<div class="flex-between mb-16">
<h5 class="break-all ellipsis lighter" style="max-width: 80%">
{{ $t('views.applicationWorkflow.variable.loop', '循环变量') }}
{{ $t('views.applicationWorkflow.variable.loop') }}
</h5>
<div>
<span class="ml-4">

View File

@ -4,7 +4,7 @@
<LoopFieldTable :nodeModel="nodeModel"></LoopFieldTable>
<template v-if="loop_input_fields?.length">
<h5 class="title-decoration-1 mb-8">
{{ $t('views.applicationWorkflow.nodes.loopStartNode.loopVariable') }}
{{ $t('views.applicationWorkflow.variable.loop') }}
</h5>
<div
v-for="(item, index) in loop_input_fields || []"

View File

@ -142,7 +142,7 @@
@change="form_data.tool_params[form_data.params_nested][item.label.label] = ''"
>
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
:label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing"
/>
<el-option :label="$t('common.custom')" value="custom" />
@ -212,7 +212,7 @@
@change="form_data.tool_params[item.label.label] = ''"
>
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
:label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing"
/>
<el-option :label="$t('common.custom')" value="custom" />

View File

@ -9,10 +9,10 @@
label-width="auto"
ref="replyNodeFormRef"
>
<el-form-item :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.label')">
<el-form-item :label="$t('views.applicationWorkflow.nodes.replyNode.replyContent')">
<template #label>
<div class="flex-between">
<span>{{ $t('views.applicationWorkflow.nodes.replyNode.replyContent.label') }}</span>
<span>{{ $t('views.applicationWorkflow.nodes.replyNode.replyContent') }}</span>
<el-select
:teleported="false"
v-model="form_data.reply_type"
@ -20,7 +20,7 @@
style="width: 85px"
>
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
:label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing"
/>
<el-option
@ -34,7 +34,7 @@
<MdEditorMagnify
v-if="form_data.reply_type === 'content'"
@wheel="wheel"
:title="$t('views.applicationWorkflow.nodes.replyNode.replyContent.label')"
:title="$t('views.applicationWorkflow.nodes.replyNode.replyContent')"
v-model="form_data.content"
style="height: 150px"
@submitDialog="submitDialog"

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
:title="isEdit ? $t('common.param.editParam') : $t('common.param.addParam')"
:title="isEdit ? $t('views.applicationWorkflow.nodes.variableAggregationNode.editGroup') : $t('views.applicationWorkflow.nodes.variableAggregationNode.addGroup')"
v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
@ -16,7 +16,7 @@
require-asterisk-position="right"
>
<el-form-item
:label="$t('dynamicsForm.paramForm.field.label')"
:label="$t('common.variable')"
:required="true"
prop="field"
:rules="rules.field"
@ -24,7 +24,7 @@
<el-input
v-model="form.field"
:maxlength="64"
:placeholder="$t('dynamicsForm.paramForm.field.placeholder')"
:placeholder="$t('views.applicationWorkflow.variable.inputPlaceholder')"
show-word-limit
/>
</el-form-item>
@ -70,10 +70,10 @@ const form = ref<any>({
const rules = reactive({
label: [
{ required: true, message: t('dynamicsForm.paramForm.name.requiredMessage'), trigger: 'blur' },
{ required: true, message: t('views.applicationWorkflow.variable.inputPlaceholder'), trigger: 'blur' },
],
field: [
{ required: true, message: t('dynamicsForm.paramForm.field.requiredMessage'), trigger: 'blur' },
{ required: true, message: t('views.applicationWorkflow.variable.inputPlaceholder'), trigger: 'blur' },
{
pattern: /^[a-zA-Z0-9_]+$/,
message: t('dynamicsForm.paramForm.field.requiredMessage2'),

View File

@ -2,67 +2,71 @@
<NodeContainer :nodeModel="nodeModel">
<h5 class="title-decoration-1 mb-8">{{ $t('views.applicationWorkflow.nodeSetting') }}</h5>
<el-form
@submit.prevent
:model="form_data"
label-position="top"
require-asterisk-position="right"
label-width="auto"
ref="VariableAggregationRef"
hide-required-asterisk
>
@submit.prevent
:model="form_data"
label-position="top"
require-asterisk-position="right"
label-width="auto"
ref="VariableAggregationRef"
hide-required-asterisk
>
<el-form-item
:label="$t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy')"
:rules="{
required: true,
trigger: 'change',
}"
>
<template #label>
<div class="flex-between">
<div>
<span>{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy') }}
<span class="color-danger">*</span>
</span>
</div>
:label="$t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy')"
:rules="{
required: true,
trigger: 'change',
}"
>
<template #label>
<div class="flex-between">
<div>
<span
>{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.Strategy') }}
<span class="color-danger">*</span>
</span>
</div>
</template>
<el-select
v-model="form_data.strategy"
>
<el-option
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder')"
value="first_non_null"
/>
<el-option
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder1')"
value="variable_to_json"
/>
</el-select>
</div>
</template>
<el-select v-model="form_data.strategy">
<el-option
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder')"
value="first_non_null"
/>
<el-option
:label="t('views.applicationWorkflow.nodes.variableAggregationNode.placeholder1')"
value="variable_to_json"
/>
</el-select>
</el-form-item>
<div v-for="(group, gIndex) in form_data.group_list" :key="group.id" class="mb-8">
<el-card shadow="never" class="card-never" style="--el-card-padding: 12px">
<div class="flex-between mb-12">
<span class="font-bold">{{ group.label }}</span>
<div class="flex align-center">
<el-button @click="openAddOrEditDialog(group,gIndex)" size="large" link>
<div class="flex align-center" style="margin-right: -3px;">
<el-button @click="openAddOrEditDialog(group, gIndex)" link>
<el-icon><EditPen /></el-icon>
</el-button>
<el-button @click="deleteGroup(gIndex)" size="large" link :disabled="form_data.group_list.length <= 1">
<el-button
@click="deleteGroup(gIndex)"
link
:disabled="form_data.group_list.length <= 1"
>
<AppIcon iconName="app-delete"></AppIcon>
</el-button>
</div>
</div>
<div v-for="(item, vIndex) in group.variable_list" :key="item.v_id" class="mb-4">
<el-row :gutter="8">
<el-col :span="21">
<div v-for="(item, vIndex) in group.variable_list" :key="item.v_id">
<el-row>
<el-col :span="22">
<el-form-item
:prop="`group_list.${gIndex}.variable_list.${vIndex}.variable`"
:rules="{
type: 'array',
required: true,
message: $t('views.applicationWorkflow.nodes.variableAggregationNode.group.placeholder'),
message: $t(
'views.applicationWorkflow.variable.placeholder',
),
trigger: 'change',
}"
>
@ -70,16 +74,15 @@
ref="nodeCascaderRef"
:nodeModel="nodeModel"
class="w-full"
:placeholder="$t('views.applicationWorkflow.nodes.variableAggregationNode.group.placeholder')"
:placeholder="$t('views.applicationWorkflow.variable.placeholder')"
v-model="item.variable"
/>
</el-form-item>
</el-col>
<el-col :span="3" style="text-align: center;">
<el-col :span="2">
<el-button
link
size="large"
class="mt-4"
class="mt-4 ml-4"
:disabled="group.variable_list.length <= 1"
@click="deleteVariable(gIndex, vIndex)"
>
@ -90,18 +93,17 @@
</div>
<el-button @click="addVariable(gIndex)" type="primary" size="large" link>
<AppIcon iconName="app-add-outlined" class="mr-4"/>
<AppIcon iconName="app-add-outlined" class="mr-4" />
{{ $t('common.add') }}
</el-button>
</el-card>
</div>
<el-button @click="openAddOrEditDialog()" type="primary" size="large" link>
<AppIcon iconName="app-add-outlined" class="mr-4"/>
{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.add') }}
<AppIcon iconName="app-add-outlined" class="mr-4" />
{{ $t('views.applicationWorkflow.nodes.variableAggregationNode.addGroup') }}
</el-button>
</el-form>
<GroupFieldDialog ref="GroupFieldDialogRef" @refresh="refreshFieldList"></GroupFieldDialog>
</el-form>
<GroupFieldDialog ref="GroupFieldDialogRef" @refresh="refreshFieldList"></GroupFieldDialog>
</NodeContainer>
</template>
<script setup lang="ts">
@ -130,11 +132,11 @@ const form = {
variable_list: [
{
v_id: randomId(),
variable: []
}
]
variable: [],
},
],
},
]
],
}
const form_data = computed({
get: () => {
@ -147,7 +149,7 @@ const form_data = computed({
},
set: (value) => {
set(props.nodeModel.properties, 'node_data', value)
}
},
})
const inputFieldList = ref<any[]>([])
@ -160,7 +162,7 @@ function openAddOrEditDialog(group?: any, index?: any) {
label: group.label,
}
}
GroupFieldDialogRef.value.open(data,index)
GroupFieldDialogRef.value.open(data, index)
}
function refreshFieldList(data: any, index: any) {
@ -178,9 +180,7 @@ function refreshFieldList(data: any, index: any) {
editGroupDesc(data, index)
}
GroupFieldDialogRef.value.close()
const fields = [
...inputFieldList.value.map((item) => ({ label: item.label, value: item.field })),
]
const fields = [...inputFieldList.value.map((item) => ({ label: item.label, value: item.field }))]
set(props.nodeModel.properties.config, 'fields', fields)
}
@ -193,23 +193,23 @@ const editGroupDesc = (data: any, gIndex: any) => {
const deleteGroup = (gIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list.splice(gIndex,1)
c_group_list.splice(gIndex, 1)
form_data.value.group_list = c_group_list
inputFieldList.value.splice(gIndex, 1)
const fields = c_group_list.map((item:any) => ({ label: item.label, value: item.field}))
const fields = c_group_list.map((item: any) => ({ label: item.label, value: item.field }))
set(props.nodeModel.properties.config, 'fields', fields)
}
const addVariable = (gIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list[gIndex].variable_list.push({
v_id: randomId(),
variable: []
v_id: randomId(),
variable: [],
})
form_data.value.group_list = c_group_list
}
const deleteVariable = (gIndex: number,vIndex: number) => {
const deleteVariable = (gIndex: number, vIndex: number) => {
const c_group_list = cloneDeep(form_data.value.group_list)
c_group_list[gIndex].variable_list.splice(vIndex, 1)
form_data.value.group_list = c_group_list
@ -220,24 +220,24 @@ const addGroup = (data: any) => {
c_group_list.push({
id: randomId(),
field: data.field,
label: data.label,
variable_list: [{
v_id: randomId(),
variable: []
}]
label: data.label,
variable_list: [
{
v_id: randomId(),
variable: [],
},
],
})
form_data.value.group_list = c_group_list
}
const validate = async () => {
const validate_list = [
...nodeCascaderRef.value.map((item:any)=>item.validate()),
...nodeCascaderRef.value.map((item: any) => item.validate()),
VariableAggregationRef.value?.validate(),
]
return Promise.all(validate_list).catch((err) => {
return Promise.reject({node: props.nodeModel, errMessage: err})
return Promise.reject({ node: props.nodeModel, errMessage: err })
})
}
@ -249,12 +249,16 @@ onMounted(() => {
}
set(props.nodeModel, 'validate', validate)
if (props.nodeModel.properties.node_data.group_list) {
inputFieldList.value = form_data.value.group_list.map((item:any) => ({ label: item.label, field: item.field}))
inputFieldList.value = form_data.value.group_list.map((item: any) => ({
label: item.label,
field: item.field,
}))
}
const fields = form_data.value.group_list.map((item: any) => ({ label: item.label, value: item.field }))
const fields = form_data.value.group_list.map((item: any) => ({
label: item.label,
value: item.field,
}))
set(props.nodeModel.properties.config, 'fields', fields)
})
</script>
<style lang="scss" scoped></style>

View File

@ -44,7 +44,7 @@
>
<el-select :teleported="false" v-model="item.source" size="small" style="width: 85px">
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
:label="$t('views.applicationWorkflow.variable.Referencing')"
value="referencing"
/>
<el-option :label="$t('common.custom')" value="custom" />

View File

@ -29,7 +29,7 @@
v-model="form.field"
:maxlength="64"
:placeholder="
$t('views.applicationWorkflow.nodes.variableSplittingNode.variablePlaceholder')
$t('views.applicationWorkflow.variable.inputPlaceholder')
"
show-word-limit
/>