diff --git a/ui/src/workflow/nodes/function-lib-node/index.vue b/ui/src/workflow/nodes/function-lib-node/index.vue index 794cabd20..51948fd22 100644 --- a/ui/src/workflow/nodes/function-lib-node/index.vue +++ b/ui/src/workflow/nodes/function-lib-node/index.vue @@ -91,6 +91,7 @@ import { ref, computed, onMounted } from 'vue' import { isLastNode } from '@/workflow/common/data' import applicationApi from '@/api/application' import { app } from '@/main' +import {t} from "@/locales"; const props = defineProps<{ nodeModel: any }>() const nodeCascaderRef = ref() @@ -119,8 +120,16 @@ const chat_data = computed({ const FunctionNodeFormRef = ref() const validate = () => { + for (const item of chat_data.value.input_field_list) { + if (item.source === 'reference' && item.is_required && item.value[0] !== 'global') { + if (props.nodeModel.graphModel.nodes.filter((node: any) => node.id === item.value[0]).length === 0 ) { + item.value = [] + return Promise.reject({node: props.nodeModel, errMessage: item.name + t('dynamicsForm.tip.requiredMessage')}) + } + } + } return FunctionNodeFormRef.value?.validate().catch((err) => { - return Promise.reject({ node: props.nodeModel, errMessage: err }) + return Promise.reject({node: props.nodeModel, errMessage: err}) }) }