fix: iteration not support file item

This commit is contained in:
Joel 2024-10-15 11:20:45 +08:00
parent 81e57bcc73
commit ff7a467a1a

View File

@ -581,6 +581,16 @@ export const toNodeAvailableVars = ({
environmentVariables, environmentVariables,
conversationVariables, conversationVariables,
}) })
const itemChildren = itemType === VarType.file
? {
children: OUTPUT_FILE_SUB_VARIABLES.map((key) => {
return {
variable: key,
type: key === 'size' ? VarType.number : VarType.string,
}
}),
}
: {}
const iterationVar = { const iterationVar = {
nodeId: iterationNode?.id, nodeId: iterationNode?.id,
title: t('workflow.nodes.iteration.currentIteration'), title: t('workflow.nodes.iteration.currentIteration'),
@ -588,6 +598,7 @@ export const toNodeAvailableVars = ({
{ {
variable: 'item', variable: 'item',
type: itemType, type: itemType,
...itemChildren,
}, },
{ {
variable: 'index', variable: 'index',