feat: support template transform output var

This commit is contained in:
Joel 2024-03-13 15:21:51 +08:00
parent 9bca3f8fd7
commit e686d42262
2 changed files with 13 additions and 1 deletions

View File

@ -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,
},
]

View File

@ -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