From 285490666f284e9de86e144759fff16702145fbb Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Tue, 3 Feb 2026 11:50:26 -0800 Subject: [PATCH] fix v2 blocmks for ocr --- apps/sim/blocks/blocks/pulse.ts | 11 +++++++++-- apps/sim/blocks/blocks/reducto.ts | 11 +++++++++-- apps/sim/blocks/blocks/textract.ts | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/apps/sim/blocks/blocks/pulse.ts b/apps/sim/blocks/blocks/pulse.ts index 76119d1b1..fa8347a05 100644 --- a/apps/sim/blocks/blocks/pulse.ts +++ b/apps/sim/blocks/blocks/pulse.ts @@ -130,7 +130,12 @@ export const PulseBlock: BlockConfig = { } const pulseV2Inputs = PulseBlock.inputs - ? Object.fromEntries(Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath')) + ? { + ...Object.fromEntries( + Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath') + ), + fileReference: { type: 'json', description: 'File reference (advanced mode)' }, + } : {} const pulseV2SubBlocks = (PulseBlock.subBlocks || []).flatMap((subBlock) => { if (subBlock.id === 'filePath') { @@ -178,7 +183,9 @@ export const PulseV2Block: BlockConfig = { apiKey: params.apiKey.trim(), } - const normalizedFiles = normalizeFileInput(params.fileUpload || params.document) + const normalizedFiles = normalizeFileInput( + params.fileUpload || params.fileReference || params.document + ) if (!normalizedFiles || normalizedFiles.length === 0) { throw new Error('Document file is required') } diff --git a/apps/sim/blocks/blocks/reducto.ts b/apps/sim/blocks/blocks/reducto.ts index 8e7c13b8e..62a973ee4 100644 --- a/apps/sim/blocks/blocks/reducto.ts +++ b/apps/sim/blocks/blocks/reducto.ts @@ -136,7 +136,12 @@ export const ReductoBlock: BlockConfig = { } const reductoV2Inputs = ReductoBlock.inputs - ? Object.fromEntries(Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath')) + ? { + ...Object.fromEntries( + Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath') + ), + fileReference: { type: 'json', description: 'File reference (advanced mode)' }, + } : {} const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).flatMap((subBlock) => { if (subBlock.id === 'filePath') { @@ -182,7 +187,9 @@ export const ReductoV2Block: BlockConfig = { apiKey: params.apiKey.trim(), } - const documentInput = normalizeFileInput(params.fileUpload || params.document) + const documentInput = normalizeFileInput( + params.fileUpload || params.fileReference || params.document + ) if (!documentInput || documentInput.length === 0) { throw new Error('PDF document file is required') } diff --git a/apps/sim/blocks/blocks/textract.ts b/apps/sim/blocks/blocks/textract.ts index 19f32b541..b59055c21 100644 --- a/apps/sim/blocks/blocks/textract.ts +++ b/apps/sim/blocks/blocks/textract.ts @@ -193,7 +193,12 @@ export const TextractBlock: BlockConfig = { } const textractV2Inputs = TextractBlock.inputs - ? Object.fromEntries(Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath')) + ? { + ...Object.fromEntries( + Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath') + ), + fileReference: { type: 'json', description: 'File reference (advanced mode)' }, + } : {} const textractV2SubBlocks = (TextractBlock.subBlocks || []).flatMap((subBlock) => { if (subBlock.id === 'filePath') { @@ -260,7 +265,9 @@ export const TextractV2Block: BlockConfig = { } parameters.s3Uri = params.s3Uri.trim() } else { - const files = normalizeFileInput(params.fileUpload || params.document) + const files = normalizeFileInput( + params.fileUpload || params.fileReference || params.document + ) if (!files || files.length === 0) { throw new Error('Document file is required') }