| LOCAL_FILE_OUTPUT, | LOCAL_FILE_OUTPUT, | ||||
| } from './constants' | } from './constants' | ||||
| import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types' | import { VarType as VarKindType } from '@/app/components/workflow/nodes/tool/types' | ||||
| import type { AnyObj } from '../_base/components/variable/match-schema-type' | |||||
| import { getMatchedSchemaType } from '../_base/components/variable/use-match-schema-type' | |||||
| const i18nPrefix = 'workflow.errorMsg' | const i18nPrefix = 'workflow.errorMsg' | ||||
| errorMessage, | errorMessage, | ||||
| } | } | ||||
| }, | }, | ||||
| getOutputVars(payload, allPluginInfoList, ragVars = [], { getMatchedSchemaType } = { getMatchedSchemaType: (_obj: AnyObj) => '' }) { | |||||
| getOutputVars(payload, allPluginInfoList, ragVars = [], { schemaTypeDefinitions } = { schemaTypeDefinitions: [] }) { | |||||
| const { | const { | ||||
| plugin_id, | plugin_id, | ||||
| datasource_name, | datasource_name, | ||||
| let type = dataType === 'array' | let type = dataType === 'array' | ||||
| ? `array[${output.items?.type.slice(0, 1).toLocaleLowerCase()}${output.items?.type.slice(1)}]` | ? `array[${output.items?.type.slice(0, 1).toLocaleLowerCase()}${output.items?.type.slice(1)}]` | ||||
| : `${dataType.slice(0, 1).toLocaleLowerCase()}${dataType.slice(1)}` | : `${dataType.slice(0, 1).toLocaleLowerCase()}${dataType.slice(1)}` | ||||
| const schemaType = getMatchedSchemaType?.(output) | |||||
| const schemaType = getMatchedSchemaType?.(output, schemaTypeDefinitions) | |||||
| if (type === 'object' && schemaType === 'file') | if (type === 'object' && schemaType === 'file') | ||||
| type = 'file' | type = 'file' |