mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
fix: type error
This commit is contained in:
@ -5,6 +5,13 @@ import { VarType as WorkflowVarType } from '../../types'
|
||||
import { getOperators } from '../if-else/utils'
|
||||
import { OrderBy } from './types'
|
||||
|
||||
const filterableVarTypes: readonly VarType[] = [
|
||||
WorkflowVarType.arrayNumber,
|
||||
WorkflowVarType.arrayString,
|
||||
WorkflowVarType.arrayBoolean,
|
||||
WorkflowVarType.arrayFile,
|
||||
]
|
||||
|
||||
export const getItemVarType = (varType?: VarType) => {
|
||||
switch (varType) {
|
||||
case WorkflowVarType.arrayNumber:
|
||||
@ -33,12 +40,7 @@ export const getItemVarTypeShowName = (itemVarType?: VarType, hasVariable?: bool
|
||||
export const supportsSubVariable = (varType?: VarType) => varType === WorkflowVarType.arrayFile
|
||||
|
||||
export const canFilterVariable = (varPayload: Var) => {
|
||||
return [
|
||||
WorkflowVarType.arrayNumber,
|
||||
WorkflowVarType.arrayString,
|
||||
WorkflowVarType.arrayBoolean,
|
||||
WorkflowVarType.arrayFile,
|
||||
].includes(varPayload.type)
|
||||
return filterableVarTypes.includes(varPayload.type)
|
||||
}
|
||||
|
||||
export const buildFilterCondition = ({
|
||||
|
||||
@ -24,7 +24,7 @@ vi.mock('../../_base/components/variable/utils', () => ({
|
||||
isSystemVar: (...args: unknown[]) => mockIsSystemVar(...args),
|
||||
}))
|
||||
|
||||
const createNode = (id: string, title: string, type = BlockEnum.Tool): Node => ({
|
||||
const createNode = (id: string, title: string, type: BlockEnum = BlockEnum.Tool): Node => ({
|
||||
id,
|
||||
position: { x: 0, y: 0 },
|
||||
data: {
|
||||
|
||||
@ -43,7 +43,7 @@ const createLoopNode = (overrides: Partial<LoopNodeType> = {}): LoopNodeType =>
|
||||
...overrides,
|
||||
})
|
||||
|
||||
const createVariableNode = (id: string, title: string, type = BlockEnum.Tool): Node => ({
|
||||
const createVariableNode = (id: string, title: string, type: BlockEnum = BlockEnum.Tool): Node => ({
|
||||
id,
|
||||
position: { x: 0, y: 0 },
|
||||
data: {
|
||||
|
||||
@ -6,14 +6,16 @@ import { ValueType, VarType } from '../../types'
|
||||
import { LogicalOperator } from './types'
|
||||
import { getOperators } from './utils'
|
||||
|
||||
const loopInputVarTypes: readonly VarType[] = [
|
||||
VarType.array,
|
||||
VarType.arrayString,
|
||||
VarType.arrayNumber,
|
||||
VarType.arrayObject,
|
||||
VarType.arrayFile,
|
||||
]
|
||||
|
||||
export const canUseAsLoopInput = (variable: Var) => {
|
||||
return [
|
||||
VarType.array,
|
||||
VarType.arrayString,
|
||||
VarType.arrayNumber,
|
||||
VarType.arrayObject,
|
||||
VarType.arrayFile,
|
||||
].includes(variable.type)
|
||||
return loopInputVarTypes.includes(variable.type)
|
||||
}
|
||||
|
||||
export const updateErrorHandleMode = (
|
||||
|
||||
Reference in New Issue
Block a user