diff --git a/app/w/[id]/components/workflow-block/workflow-block.tsx b/app/w/[id]/components/workflow-block/workflow-block.tsx index 150b080e48..496cc3448f 100644 --- a/app/w/[id]/components/workflow-block/workflow-block.tsx +++ b/app/w/[id]/components/workflow-block/workflow-block.tsx @@ -128,11 +128,21 @@ export function WorkflowBlock({ id, data }: NodeProps) { ? mergedState?.subBlocks[block.condition.and.field]?.value : undefined + // Check if the condition value is an array + const isValueMatch = Array.isArray(block.condition.value) + ? fieldValue != null && + block.condition.value.includes(fieldValue as string | number | boolean) + : fieldValue === block.condition.value + // Check both conditions if 'and' is present - return ( - fieldValue === block.condition.value && - (!block.condition.and || andFieldValue === block.condition.and.value) - ) + const isAndValueMatch = + !block.condition.and || + (Array.isArray(block.condition.and.value) + ? andFieldValue != null && + block.condition.and.value.includes(andFieldValue as string | number | boolean) + : andFieldValue === block.condition.and.value) + + return isValueMatch && isAndValueMatch }) visibleSubBlocks.forEach((block) => { diff --git a/blocks/blocks/agent.ts b/blocks/blocks/agent.ts index b32f301199..bdfcfaf77d 100644 --- a/blocks/blocks/agent.ts +++ b/blocks/blocks/agent.ts @@ -60,6 +60,10 @@ export const AgentBlock: BlockConfig = { layout: 'half', min: 0, max: 1, + condition: { + field: 'model', + value: ['gpt-4o', 'gemini-2.0-flash'], + }, }, { id: 'apiKey', diff --git a/blocks/types.ts b/blocks/types.ts index f03085c88e..c228b764a2 100644 --- a/blocks/types.ts +++ b/blocks/types.ts @@ -93,10 +93,10 @@ export interface SubBlockConfig { value?: (params: Record) => string condition?: { field: string - value: string | number | boolean + value: string | number | boolean | Array and?: { field: string - value: string | number | boolean + value: string | number | boolean | Array } } // OAuth specific properties