From 4dc28666d47deea5f22a72dbef3647bf56e28cc1 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 28 Jun 2024 12:15:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/flow/workflow_manage.py | 24 ++-- ui/src/workflow/common/NodeCascader.vue | 4 +- ui/src/workflow/common/NodeContainer.vue | 38 +++-- ui/src/workflow/common/app-node.ts | 9 +- ui/src/workflow/common/data.ts | 175 +++++++++++++---------- 5 files changed, 138 insertions(+), 112 deletions(-) diff --git a/apps/application/flow/workflow_manage.py b/apps/application/flow/workflow_manage.py index 403f3a552..f99d9351b 100644 --- a/apps/application/flow/workflow_manage.py +++ b/apps/application/flow/workflow_manage.py @@ -235,15 +235,21 @@ class WorkflowManage: for node in self.node_context: properties = node.node.properties - fields = properties.get('fields') - if fields is not None: - for field in fields: - prompt = prompt.replace(field.get('globeLabel'), field.get('globeValue')) - global_fields = properties.get('globalFields') - if global_fields is not None: - for field in global_fields: - prompt = prompt.replace(field.get('globeLabel'), field.get('globeValue')) - context[node.id] = node.context + node_config = properties.get('config') + if node_config is not None: + fields = node_config.get('fields') + if fields is not None: + for field in fields: + globeLabel = f"{properties.get('stepName')}.{field.get('value')}" + globeValue = f"context['{node.id}'].{field.get('value')}" + prompt = prompt.replace(globeLabel, globeValue) + global_fields = node_config.get('globalFields') + if global_fields is not None: + for field in global_fields: + globeLabel = f"全局变量.{field.get('value')}" + globeValue = f"context['global'].{field.get('value')}" + prompt = prompt.replace(globeLabel, globeValue) + context[node.id] = node.context prompt_template = PromptTemplate.from_template(prompt, template_format='jinja2') value = prompt_template.format(context=context) diff --git a/ui/src/workflow/common/NodeCascader.vue b/ui/src/workflow/common/NodeCascader.vue index feb6ba1f5..dfb50f2f0 100644 --- a/ui/src/workflow/common/NodeCascader.vue +++ b/ui/src/workflow/common/NodeCascader.vue @@ -53,14 +53,14 @@ function _getIncomingNode(id: String, startId: String) { value: item.id, label: item.properties.stepName, type: item.type, - children: item.properties?.fields || [] + children: item.properties?.config?.fields || [] }) if (item.properties?.globalFields && item.type === 'start-node') { firstElement = { value: 'global', label: '全局变量', type: 'global', - children: item.properties?.globalFields || [] + children: item.properties?.config?.globalFields || [] } } } diff --git a/ui/src/workflow/common/NodeContainer.vue b/ui/src/workflow/common/NodeContainer.vue index 01952d249..3ad2a38ac 100644 --- a/ui/src/workflow/common/NodeContainer.vue +++ b/ui/src/workflow/common/NodeContainer.vue @@ -41,11 +41,11 @@ -
+
-