From e686d42262a481567a5a14295105a444ff4677e0 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 13 Mar 2024 15:21:51 +0800 Subject: [PATCH] feat: support template transform output var --- web/app/components/workflow/constants.ts | 7 +++++++ .../workflow/nodes/_base/components/variable/utils.ts | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts index c2bba4b40b..623def49e8 100644 --- a/web/app/components/workflow/constants.ts +++ b/web/app/components/workflow/constants.ts @@ -256,3 +256,10 @@ export const KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT: Var[] = [ type: VarType.arrayObject, }, ] + +export const TEMPLATE_TRANSFORM_OUTPUT_STRUCT: Var[] = [ + { + variable: 'output', + type: VarType.string, + }, +] diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index ec827ce62f..cc6f73e539 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -2,7 +2,7 @@ import type { CodeNodeType } from '../../../code/types' import { BlockEnum, InputVarType, VarType } from '@/app/components/workflow/types' import type { StartNodeType } from '@/app/components/workflow/nodes/start/types' import type { NodeOutPutVar } from '@/app/components/workflow/types' -import { KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, LLM_OUTPUT_STRUCT, SUPPORT_OUTPUT_VARS_NODE } from '@/app/components/workflow/constants' +import { KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, LLM_OUTPUT_STRUCT, SUPPORT_OUTPUT_VARS_NODE, TEMPLATE_TRANSFORM_OUTPUT_STRUCT } from '@/app/components/workflow/constants' const inputVarTypeToVarType = (type: InputVarType): VarType => { if (type === InputVarType.number) @@ -54,6 +54,11 @@ const formatItem = (item: any): NodeOutPutVar => { }) break } + + case BlockEnum.TemplateTransform: { + res.vars = TEMPLATE_TRANSFORM_OUTPUT_STRUCT + break + } } return res