Skip to content

Commit ab492d8

Browse files
wangdan-fit2cloudliuruibin
authored andcommitted
feat: Workfloat support variable assign(#2114)
1 parent 5199ab8 commit ab492d8

File tree

10 files changed

+72
-104
lines changed

10 files changed

+72
-104
lines changed

ui/src/assets/icon_assigner.svg

Lines changed: 5 additions & 0 deletions
Loading

ui/src/locales/lang/en-US/views/application-workflow.ts

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
autoSave: 'Auto Save',
2020
latestRelease: 'Latest Release',
2121
copyParam: 'Copy Parameters',
22-
debug: 'Run',
22+
debug: 'Run'
2323
},
2424
tip: {
2525
publicSuccess: 'Published successfully',
@@ -48,12 +48,13 @@ export default {
4848
beautify: 'Auto-Arrange'
4949
},
5050
variable: {
51+
label: 'Variable',
5152
global: 'Global Variable',
5253
Referencing: 'Referenced Variable',
5354
ReferencingRequired: 'Referenced variable is required',
5455
ReferencingError: 'Invalid referenced variable',
5556
NoReferencing: 'Referenced variable does not exist',
56-
fieldMessage: 'Please select a variable'
57+
placeholder: 'Please select a variable'
5758
},
5859
condition: {
5960
title: 'Execution Condition',
@@ -82,12 +83,11 @@ export default {
8283
baseNode: {
8384
label: 'Base Information',
8485
appName: {
85-
label: 'App Name',
86-
86+
label: 'App Name'
8787
},
8888
appDescription: {
89-
label: 'App Description',
90-
},
89+
label: 'App Description'
90+
},
9191
fileUpload: {
9292
label: 'File Upload',
9393
tooltip: 'When enabled, the Q&A page will display a file upload button.'
@@ -114,7 +114,7 @@ export default {
114114
If you want the user to see the output of this node, please turn on the switch.`
115115
},
116116
defaultPrompt: 'Known Information',
117-
think: 'Thinking Process',
117+
think: 'Thinking Process'
118118
},
119119
searchDatasetNode: {
120120
label: 'Knowledge Retrieval',
@@ -188,8 +188,7 @@ export default {
188188
label: 'Form Output Content',
189189
requiredMessage:
190190
'Please set the output content of this node, { form } is a placeholder for the form.',
191-
tooltip:
192-
'Define the output content of this node. { form } is a placeholder for the form'
191+
tooltip: 'Define the output content of this node. { form } is a placeholder for the form'
193192
},
194193
formAllContent: 'All Form Content',
195194
formSetting: 'Form Configuration'
@@ -213,20 +212,9 @@ export default {
213212
}
214213
},
215214
variableAssignNode: {
216-
label: 'Variable assign',
215+
label: 'Variable Assign',
217216
text: 'Update the value of the global variable',
218-
variable: {
219-
label: 'select variable',
220-
requiredMessage: 'Please select a variable'
221-
},
222-
value: {
223-
label: 'Set value',
224-
},
225-
source: {
226-
reference: 'Reference Variable',
227-
custom: 'Custom'
228-
},
229-
addVariable: 'Add Variable',
217+
assign: 'Set Value'
230218
},
231219
imageGenerateNode: {
232220
label: 'Image Generation',
@@ -238,13 +226,11 @@ export default {
238226
},
239227
prompt: {
240228
label: 'Positive Prompt',
241-
tooltip:
242-
'Describe elements and visual features you want in the generated image'
229+
tooltip: 'Describe elements and visual features you want in the generated image'
243230
},
244231
negative_prompt: {
245232
label: 'Negative Prompt',
246-
tooltip:
247-
'Describe elements you want to exclude from the generated image',
233+
tooltip: 'Describe elements you want to exclude from the generated image',
248234
placeholder:
249235
'Please describe content you do not want to generate, such as color, bloody content'
250236
}

ui/src/locales/lang/zh-CN/views/application-workflow.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
autoSave: '自动保存',
2020
latestRelease: '最近发布',
2121
copyParam: '复制参数',
22-
debug: '调试',
22+
debug: '调试'
2323
},
2424
tip: {
2525
publicSuccess: '发布成功',
@@ -48,12 +48,13 @@ export default {
4848
beautify: '一键美化'
4949
},
5050
variable: {
51+
label: '变量',
5152
global: '全局变量',
5253
Referencing: '引用变量',
5354
ReferencingRequired: '引用变量必填',
5455
ReferencingError: '引用变量错误',
5556
NoReferencing: '不存在的引用变量',
56-
fieldMessage: '请选择变量'
57+
placeholder: '请选择变量'
5758
},
5859
condition: {
5960
title: '执行条件',
@@ -83,12 +84,11 @@ export default {
8384
baseNode: {
8485
label: '基本信息',
8586
appName: {
86-
label: '应用名称',
87-
87+
label: '应用名称'
8888
},
8989
appDescription: {
90-
label: '应用描述',
91-
},
90+
label: '应用描述'
91+
},
9292
fileUpload: {
9393
label: '文件上传',
9494
tooltip: '开启后,问答页面会显示上传文件的按钮。'
@@ -115,7 +115,7 @@ export default {
115115
如果你想让用户看到该节点的输出内容,请打开开关。`
116116
},
117117
defaultPrompt: '已知信息',
118-
think: '思考过程',
118+
think: '思考过程'
119119
},
120120
searchDatasetNode: {
121121
label: '知识库检索',
@@ -214,18 +214,7 @@ export default {
214214
variableAssignNode: {
215215
label: '变量赋值',
216216
text: '更新全局变量的值',
217-
variable: {
218-
label: '选择变量',
219-
requiredMessage: '请选择变量'
220-
},
221-
value: {
222-
label: '赋值',
223-
},
224-
source: {
225-
reference: '引用变量',
226-
custom: '自定义'
227-
},
228-
addVariable: '添加变量'
217+
assign: '赋值'
229218
},
230219
imageGenerateNode: {
231220
label: '图片生成',

ui/src/locales/lang/zh-Hant/views/application-workflow.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ export default {
4848
beautify: '一鍵美化'
4949
},
5050
variable: {
51+
label: '變量',
5152
global: '全局變量',
5253
Referencing: '引用變量',
5354
ReferencingRequired: '引用變量必填',
5455
ReferencingError: '引用變量錯誤',
5556
NoReferencing: '不存在的引用變量',
56-
fieldMessage: '請選擇變量'
57+
placeholder: '請選擇變量'
5758
},
5859
condition: {
5960
title: '執行條件',
@@ -114,7 +115,7 @@ export default {
114115
如果你想讓用戶看到該節點的輸出內容,請打開開關。`
115116
},
116117
defaultPrompt: '已知信息',
117-
think: '思考過程',
118+
think: '思考過程'
118119
},
119120
searchDatasetNode: {
120121
label: '知識庫檢索',
@@ -213,18 +214,7 @@ export default {
213214
variableAssignNode: {
214215
label: '變數賦值',
215216
text: '更新全域變數的值',
216-
variable: {
217-
label: '選擇變數',
218-
requiredMessage: '請選擇變數'
219-
},
220-
value: {
221-
label: '設置值',
222-
},
223-
source: {
224-
reference: '引用變數',
225-
custom: '自定義'
226-
},
227-
addVariable: '添加變數',
217+
assign: '賦值'
228218
},
229219
imageGenerateNode: {
230220
label: '圖片生成',

ui/src/workflow/common/NodeCascader.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { t } from '@/locales'
2525
const props = defineProps<{
2626
nodeModel: any
2727
modelValue: Array<any>
28+
global?: Boolean
2829
}>()
2930
const emit = defineEmits(['update:modelValue'])
3031
const data = computed({
@@ -49,7 +50,9 @@ const wheel = (e: any) => {
4950
5051
function visibleChange(bool: boolean) {
5152
if (bool) {
52-
options.value = props.nodeModel.get_up_node_field_list(false, true)
53+
options.value = props.global
54+
? props.nodeModel.get_up_node_field_list(false, true).filter((v) => v.value === 'global')
55+
: props.nodeModel.get_up_node_field_list(false, true)
5356
}
5457
}
5558
@@ -76,7 +79,9 @@ const validate = () => {
7679
}
7780
defineExpose({ validate })
7881
onMounted(() => {
79-
options.value = props.nodeModel.get_up_node_field_list(false, true)
82+
options.value = props.global
83+
? props.nodeModel.get_up_node_field_list(false, true).filter((v) => v.value === 'global')
84+
: props.nodeModel.get_up_node_field_list(false, true)
8085
})
8186
</script>
8287
<style scoped></style>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<AppAvatar shape="square" style="background: #FF8800">
3-
<img src="@/assets/icon_reply.svg" style="width: 65%" alt="" />
2+
<AppAvatar shape="square">
3+
<img src="@/assets/icon_assigner.svg" style="width: 65%" alt="" />
44
</AppAvatar>
55
</template>
66
<script setup lang="ts"></script>

ui/src/workflow/nodes/condition-node/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
:rules="{
4949
type: 'array',
5050
required: true,
51-
message: $t('views.applicationWorkflow.variable.fieldMessage'),
51+
message: $t('views.applicationWorkflow.variable.placeholder'),
5252
trigger: 'change'
5353
}"
5454
>
@@ -57,7 +57,7 @@
5757
:nodeModel="nodeModel"
5858
class="w-full"
5959
:placeholder="
60-
$t('views.applicationWorkflow.variable.fieldMessage')
60+
$t('views.applicationWorkflow.variable.placeholder')
6161
"
6262
v-model="condition.field"
6363
/>

ui/src/workflow/nodes/reranker-node/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
:rules="{
4646
type: 'array',
4747
required: true,
48-
message: $t('views.applicationWorkflow.variable.fieldMessage'),
48+
message: $t('views.applicationWorkflow.variable.placeholder'),
4949
trigger: 'change'
5050
}"
5151
>
File renamed without changes.

0 commit comments

Comments
 (0)