Skip to content

Commit cbe0f8a

Browse files
committed
fix ocr integrations
1 parent 6e642fc commit cbe0f8a

File tree

3 files changed

+69
-14
lines changed

3 files changed

+69
-14
lines changed

apps/sim/blocks/blocks/pulse.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,34 @@ export const PulseBlock: BlockConfig<PulseParserOutput> = {
132132
const pulseV2Inputs = PulseBlock.inputs
133133
? Object.fromEntries(Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath'))
134134
: {}
135-
const pulseV2SubBlocks = (PulseBlock.subBlocks || []).filter(
136-
(subBlock) => subBlock.id !== 'filePath'
137-
)
135+
const pulseV2SubBlocks = (PulseBlock.subBlocks || []).flatMap((subBlock) => {
136+
if (subBlock.id === 'filePath') {
137+
return [] // Remove the old filePath subblock
138+
}
139+
if (subBlock.id === 'fileUpload') {
140+
// Insert fileReference right after fileUpload
141+
return [
142+
subBlock,
143+
{
144+
id: 'fileReference',
145+
title: 'Document',
146+
type: 'short-input' as SubBlockType,
147+
canonicalParamId: 'document',
148+
placeholder: 'File reference',
149+
mode: 'advanced' as const,
150+
},
151+
]
152+
}
153+
return [subBlock]
154+
})
138155

139156
export const PulseV2Block: BlockConfig<PulseParserOutput> = {
140157
...PulseBlock,
141158
type: 'pulse_v2',
142-
name: 'Pulse (File Only)',
159+
name: 'Pulse',
143160
hideFromToolbar: false,
144161
longDescription:
145-
'Integrate Pulse into the workflow. Extract text from PDF documents, images, and Office files via upload.',
162+
'Integrate Pulse into the workflow. Extract text from PDF documents, images, and Office files via upload or file references.',
146163
subBlocks: pulseV2SubBlocks,
147164
tools: {
148165
access: ['pulse_parser_v2'],

apps/sim/blocks/blocks/reducto.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,32 @@ export const ReductoBlock: BlockConfig<ReductoParserOutput> = {
138138
const reductoV2Inputs = ReductoBlock.inputs
139139
? Object.fromEntries(Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath'))
140140
: {}
141-
const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).filter(
142-
(subBlock) => subBlock.id !== 'filePath'
143-
)
141+
const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).flatMap((subBlock) => {
142+
if (subBlock.id === 'filePath') {
143+
return []
144+
}
145+
if (subBlock.id === 'fileUpload') {
146+
return [
147+
subBlock,
148+
{
149+
id: 'fileReference',
150+
title: 'PDF Document',
151+
type: 'short-input' as SubBlockType,
152+
canonicalParamId: 'document',
153+
placeholder: 'File reference',
154+
mode: 'advanced' as const,
155+
},
156+
]
157+
}
158+
return [subBlock]
159+
})
144160

145161
export const ReductoV2Block: BlockConfig<ReductoParserOutput> = {
146162
...ReductoBlock,
147163
type: 'reducto_v2',
148-
name: 'Reducto (File Only)',
164+
name: 'Reducto',
149165
hideFromToolbar: false,
150-
longDescription: `Integrate Reducto Parse into the workflow. Can extract text from uploaded PDF documents.`,
166+
longDescription: `Integrate Reducto Parse into the workflow. Can extract text from uploaded PDF documents or file references.`,
151167
subBlocks: reductoV2SubBlocks,
152168
tools: {
153169
access: ['reducto_parser_v2'],

apps/sim/blocks/blocks/textract.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,36 @@ export const TextractBlock: BlockConfig<TextractParserOutput> = {
195195
const textractV2Inputs = TextractBlock.inputs
196196
? Object.fromEntries(Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath'))
197197
: {}
198-
const textractV2SubBlocks = (TextractBlock.subBlocks || []).filter(
199-
(subBlock) => subBlock.id !== 'filePath'
200-
)
198+
const textractV2SubBlocks = (TextractBlock.subBlocks || []).flatMap((subBlock) => {
199+
if (subBlock.id === 'filePath') {
200+
return [] // Remove the old filePath subblock
201+
}
202+
if (subBlock.id === 'fileUpload') {
203+
// Insert fileReference right after fileUpload
204+
return [
205+
subBlock,
206+
{
207+
id: 'fileReference',
208+
title: 'Document',
209+
type: 'short-input' as SubBlockType,
210+
canonicalParamId: 'document',
211+
placeholder: 'File reference',
212+
condition: {
213+
field: 'processingMode',
214+
value: 'async',
215+
not: true,
216+
},
217+
mode: 'advanced' as const,
218+
},
219+
]
220+
}
221+
return [subBlock]
222+
})
201223

202224
export const TextractV2Block: BlockConfig<TextractParserOutput> = {
203225
...TextractBlock,
204226
type: 'textract_v2',
205-
name: 'AWS Textract (File Only)',
227+
name: 'AWS Textract',
206228
hideFromToolbar: false,
207229
subBlocks: textractV2SubBlocks,
208230
tools: {

0 commit comments

Comments
 (0)