diff --git a/apps/application/flow/step_node/variable_assign_node/impl/base_variable_assign_node.py b/apps/application/flow/step_node/variable_assign_node/impl/base_variable_assign_node.py index 1eebcf3b9..8200bd2e1 100644 --- a/apps/application/flow/step_node/variable_assign_node/impl/base_variable_assign_node.py +++ b/apps/application/flow/step_node/variable_assign_node/impl/base_variable_assign_node.py @@ -23,7 +23,7 @@ class BaseVariableAssignNode(IVariableAssignNode): 'input_value': self.get_reference_content(variable['fields']), } if variable['source'] == 'custom': - if variable['type'] in ['dict', 'array']: + if variable['type'] == 'json': if isinstance(variable['value'], dict) or isinstance(variable['value'], list): val = variable['value'] else: @@ -31,8 +31,10 @@ class BaseVariableAssignNode(IVariableAssignNode): self.workflow_manage.context[variable['fields'][1]] = val result['output_value'] = variable['value'] = val else: - self.workflow_manage.context[variable['fields'][1]] = variable['value'] - result['output_value'] = variable['value'] + # 变量解析 例如:{{global.xxx}} + val = self.workflow_manage.generate_prompt(variable['value']) + self.workflow_manage.context[variable['fields'][1]] = val + result['output_value'] = val else: reference = self.get_reference_content(variable['reference']) self.workflow_manage.context[variable['fields'][1]] = reference diff --git a/ui/src/workflow/nodes/variable-assign-node/index.vue b/ui/src/workflow/nodes/variable-assign-node/index.vue index 315624b20..fe54455ef 100644 --- a/ui/src/workflow/nodes/variable-assign-node/index.vue +++ b/ui/src/workflow/nodes/variable-assign-node/index.vue @@ -60,22 +60,77 @@ -
- - - - -
- + +
+ + + + + + + + + + + + + + + + + + +
+ + @@ -101,10 +157,11 @@ import NodeCascader from '@/workflow/common/NodeCascader.vue' import { computed, onMounted, ref } from 'vue' import { isLastNode } from '@/workflow/common/data' import { randomId } from '@/utils/utils' +import { t } from '@/locales' const props = defineProps<{ nodeModel: any }>() -const typeOptions = ['string', 'int', 'dict', 'array', 'float'] +const typeOptions = ['string', 'num', 'json'] const wheel = (e: any) => { if (e.ctrlKey === true) { @@ -149,8 +206,14 @@ function submitDialog(val: string) { const replyNodeFormRef = ref() const nodeCascaderRef = ref() +const nodeCascaderRef2 = ref() const validate = async () => { - return Promise.all([replyNodeFormRef.value?.validate()]).catch((err: any) => { + // console.log(replyNodeFormRef.value.validate()) + return Promise.all([ + replyNodeFormRef.value?.validate(), + ...nodeCascaderRef.value.map((item: any) => item.validate()), + ...nodeCascaderRef2.value.map((item: any) => item.validate()) + ]).catch((err: any) => { return Promise.reject({ node: props.nodeModel, errMessage: err }) }) }