From b9e4080d03602c338961391ba8043494398eaa24 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 23 Sep 2024 14:37:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=90=8E,=E5=9C=A8=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E4=B8=AD=E5=BA=94=E8=AF=A5=E8=8A=82=E7=82=B9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=BA=94=E8=AF=A5=E6=94=B9=E4=B8=BA=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/application-workflow/index.vue | 7 +++++++ ui/src/workflow/common/validate.ts | 5 ++++- ui/src/workflow/nodes/function-lib-node/index.vue | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/src/views/application-workflow/index.vue b/ui/src/views/application-workflow/index.vue index bdaaae9a7..cbbfa765c 100644 --- a/ui/src/views/application-workflow/index.vue +++ b/ui/src/views/application-workflow/index.vue @@ -146,6 +146,13 @@ function publicHandle() { const obj = { work_flow: getGraphData() } + const workflow = new WorkFlowInstance(obj.work_flow) + try { + workflow.is_valid() + } catch (e: any) { + MsgError(e.toString()) + return + } applicationApi.putPublishApplication(id as String, obj, loading).then(() => { getDetail() MsgSuccess('发布成功') diff --git a/ui/src/workflow/common/validate.ts b/ui/src/workflow/common/validate.ts index 113fd0abc..3c8e6a494 100644 --- a/ui/src/workflow/common/validate.ts +++ b/ui/src/workflow/common/validate.ts @@ -1,6 +1,6 @@ import { WorkflowType } from '@/enums/workflow' -const end_nodes = [ +const end_nodes: Array = [ WorkflowType.AiChat, WorkflowType.Reply, WorkflowType.FunctionLib, @@ -119,6 +119,9 @@ export class WorkFlowInstance { * @param node 节点 */ private is_valid_node(node: any) { + if (node.properties.status && node.properties.status === 500) { + throw `${node.properties.stepName} 节点不可用` + } if (node.type === WorkflowType.Condition) { const branch_list = node.properties.node_data.branch for (const branch of branch_list) { diff --git a/ui/src/workflow/nodes/function-lib-node/index.vue b/ui/src/workflow/nodes/function-lib-node/index.vue index f85c4483f..92671483d 100644 --- a/ui/src/workflow/nodes/function-lib-node/index.vue +++ b/ui/src/workflow/nodes/function-lib-node/index.vue @@ -124,7 +124,7 @@ const update_field = () => { return { ...item, value: item.source == 'reference' ? [] : '' } }) set(props.nodeModel.properties.node_data, 'input_field_list', merge_input_field_list) - set(props.nodeModel.properties, 'status', 200) + set(props.nodeModel.properties, 'status', ok.data.is_active ? 200 : 500) }) .catch((err) => { set(props.nodeModel.properties, 'status', 500)