fix ocr integrations

This commit is contained in:
Vikhyath Mondreti
2026-02-03 01:18:13 -08:00
parent 6e642fc705
commit cbe0f8aed2
3 changed files with 69 additions and 14 deletions

View File

@@ -132,17 +132,34 @@ export const PulseBlock: BlockConfig<PulseParserOutput> = {
const pulseV2Inputs = PulseBlock.inputs
? Object.fromEntries(Object.entries(PulseBlock.inputs).filter(([key]) => key !== 'filePath'))
: {}
const pulseV2SubBlocks = (PulseBlock.subBlocks || []).filter(
(subBlock) => subBlock.id !== 'filePath'
)
const pulseV2SubBlocks = (PulseBlock.subBlocks || []).flatMap((subBlock) => {
if (subBlock.id === 'filePath') {
return [] // Remove the old filePath subblock
}
if (subBlock.id === 'fileUpload') {
// Insert fileReference right after fileUpload
return [
subBlock,
{
id: 'fileReference',
title: 'Document',
type: 'short-input' as SubBlockType,
canonicalParamId: 'document',
placeholder: 'File reference',
mode: 'advanced' as const,
},
]
}
return [subBlock]
})
export const PulseV2Block: BlockConfig<PulseParserOutput> = {
...PulseBlock,
type: 'pulse_v2',
name: 'Pulse (File Only)',
name: 'Pulse',
hideFromToolbar: false,
longDescription:
'Integrate Pulse into the workflow. Extract text from PDF documents, images, and Office files via upload.',
'Integrate Pulse into the workflow. Extract text from PDF documents, images, and Office files via upload or file references.',
subBlocks: pulseV2SubBlocks,
tools: {
access: ['pulse_parser_v2'],

View File

@@ -138,16 +138,32 @@ export const ReductoBlock: BlockConfig<ReductoParserOutput> = {
const reductoV2Inputs = ReductoBlock.inputs
? Object.fromEntries(Object.entries(ReductoBlock.inputs).filter(([key]) => key !== 'filePath'))
: {}
const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).filter(
(subBlock) => subBlock.id !== 'filePath'
)
const reductoV2SubBlocks = (ReductoBlock.subBlocks || []).flatMap((subBlock) => {
if (subBlock.id === 'filePath') {
return []
}
if (subBlock.id === 'fileUpload') {
return [
subBlock,
{
id: 'fileReference',
title: 'PDF Document',
type: 'short-input' as SubBlockType,
canonicalParamId: 'document',
placeholder: 'File reference',
mode: 'advanced' as const,
},
]
}
return [subBlock]
})
export const ReductoV2Block: BlockConfig<ReductoParserOutput> = {
...ReductoBlock,
type: 'reducto_v2',
name: 'Reducto (File Only)',
name: 'Reducto',
hideFromToolbar: false,
longDescription: `Integrate Reducto Parse into the workflow. Can extract text from uploaded PDF documents.`,
longDescription: `Integrate Reducto Parse into the workflow. Can extract text from uploaded PDF documents or file references.`,
subBlocks: reductoV2SubBlocks,
tools: {
access: ['reducto_parser_v2'],

View File

@@ -195,14 +195,36 @@ export const TextractBlock: BlockConfig<TextractParserOutput> = {
const textractV2Inputs = TextractBlock.inputs
? Object.fromEntries(Object.entries(TextractBlock.inputs).filter(([key]) => key !== 'filePath'))
: {}
const textractV2SubBlocks = (TextractBlock.subBlocks || []).filter(
(subBlock) => subBlock.id !== 'filePath'
)
const textractV2SubBlocks = (TextractBlock.subBlocks || []).flatMap((subBlock) => {
if (subBlock.id === 'filePath') {
return [] // Remove the old filePath subblock
}
if (subBlock.id === 'fileUpload') {
// Insert fileReference right after fileUpload
return [
subBlock,
{
id: 'fileReference',
title: 'Document',
type: 'short-input' as SubBlockType,
canonicalParamId: 'document',
placeholder: 'File reference',
condition: {
field: 'processingMode',
value: 'async',
not: true,
},
mode: 'advanced' as const,
},
]
}
return [subBlock]
})
export const TextractV2Block: BlockConfig<TextractParserOutput> = {
...TextractBlock,
type: 'textract_v2',
name: 'AWS Textract (File Only)',
name: 'AWS Textract',
hideFromToolbar: false,
subBlocks: textractV2SubBlocks,
tools: {