mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-04 03:35:04 -05:00
fix v2 blocmks for ocr
This commit is contained in:
@@ -130,7 +130,12 @@ export const PulseBlock: BlockConfig<PulseParserOutput> = {
|
||||
}
|
||||
|
||||
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<PulseParserOutput> = {
|
||||
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')
|
||||
}
|
||||
|
||||
@@ -136,7 +136,12 @@ export const ReductoBlock: BlockConfig<ReductoParserOutput> = {
|
||||
}
|
||||
|
||||
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<ReductoParserOutput> = {
|
||||
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')
|
||||
}
|
||||
|
||||
@@ -193,7 +193,12 @@ export const TextractBlock: BlockConfig<TextractParserOutput> = {
|
||||
}
|
||||
|
||||
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<TextractParserOutput> = {
|
||||
}
|
||||
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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user