Skip to content

Commit 2854906

Browse files
committed
fix v2 blocmks for ocr
1 parent c230e1a commit 2854906

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

apps/sim/blocks/blocks/pulse.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ export const PulseBlock: BlockConfig<PulseParserOutput> = {
130130
}
131131

132132
const pulseV2Inputs = PulseBlock.inputs
133-
? Object.fromEntries(Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath'))
133+
? {
134+
...Object.fromEntries(
135+
Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath')
136+
),
137+
fileReference: { type: 'json', description: 'File reference (advanced mode)' },
138+
}
134139
: {}
135140
const pulseV2SubBlocks = (PulseBlock.subBlocks || []).flatMap((subBlock) => {
136141
if (subBlock.id === 'filePath') {
@@ -178,7 +183,9 @@ export const PulseV2Block: BlockConfig<PulseParserOutput> = {
178183
apiKey: params.apiKey.trim(),
179184
}
180185

181-
const normalizedFiles = normalizeFileInput(params.fileUpload || params.document)
186+
const normalizedFiles = normalizeFileInput(
187+
params.fileUpload || params.fileReference || params.document
188+
)
182189
if (!normalizedFiles || normalizedFiles.length === 0) {
183190
throw new Error('Document file is required')
184191
}

apps/sim/blocks/blocks/reducto.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ export const ReductoBlock: BlockConfig<ReductoParserOutput> = {
136136
}
137137

138138
const reductoV2Inputs = ReductoBlock.inputs
139-
? Object.fromEntries(Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath'))
139+
? {
140+
...Object.fromEntries(
141+
Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath')
142+
),
143+
fileReference: { type: 'json', description: 'File reference (advanced mode)' },
144+
}
140145
: {}
141146
const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).flatMap((subBlock) => {
142147
if (subBlock.id === 'filePath') {
@@ -182,7 +187,9 @@ export const ReductoV2Block: BlockConfig<ReductoParserOutput> = {
182187
apiKey: params.apiKey.trim(),
183188
}
184189

185-
const documentInput = normalizeFileInput(params.fileUpload || params.document)
190+
const documentInput = normalizeFileInput(
191+
params.fileUpload || params.fileReference || params.document
192+
)
186193
if (!documentInput || documentInput.length === 0) {
187194
throw new Error('PDF document file is required')
188195
}

apps/sim/blocks/blocks/textract.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ export const TextractBlock: BlockConfig<TextractParserOutput> = {
193193
}
194194

195195
const textractV2Inputs = TextractBlock.inputs
196-
? Object.fromEntries(Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath'))
196+
? {
197+
...Object.fromEntries(
198+
Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath')
199+
),
200+
fileReference: { type: 'json', description: 'File reference (advanced mode)' },
201+
}
197202
: {}
198203
const textractV2SubBlocks = (TextractBlock.subBlocks || []).flatMap((subBlock) => {
199204
if (subBlock.id === 'filePath') {
@@ -260,7 +265,9 @@ export const TextractV2Block: BlockConfig<TextractParserOutput> = {
260265
}
261266
parameters.s3Uri = params.s3Uri.trim()
262267
} else {
263-
const files = normalizeFileInput(params.fileUpload || params.document)
268+
const files = normalizeFileInput(
269+
params.fileUpload || params.fileReference || params.document
270+
)
264271
if (!files || files.length === 0) {
265272
throw new Error('Document file is required')
266273
}

0 commit comments

Comments
 (0)