diff --git a/apps/sim/tools/mistral/parser.ts b/apps/sim/tools/mistral/parser.ts index 33a70e85be..70547a9061 100644 --- a/apps/sim/tools/mistral/parser.ts +++ b/apps/sim/tools/mistral/parser.ts @@ -258,7 +258,11 @@ export const mistralParserTool: ToolConfig 0) { - content = ocrResult.pages + content = mistralData.pages .map((page: any) => (page && typeof page.markdown === 'string' ? page.markdown : '')) .filter(Boolean) .join('\n\n') } else { logger.warn('No pages found in OCR result, returning raw response') - content = JSON.stringify(ocrResult, null, 2) + content = JSON.stringify(mistralData, null, 2) } - // Process based on requested result type if (resultType === 'text') { - // Strip markdown formatting content = content .replace(/##*\s/g, '') // Remove markdown headers .replace(/\*\*/g, '') // Remove bold markers .replace(/\*/g, '') // Remove italic markers .replace(/\n{3,}/g, '\n\n') // Normalize newlines } else if (resultType === 'json') { - // Return the structured data as JSON string - content = JSON.stringify(ocrResult, null, 2) + content = JSON.stringify(mistralData, null, 2) } - // Extract file information with proper validation let fileName = 'document.pdf' let fileType = 'pdf' @@ -333,27 +331,24 @@ export const mistralParserTool: ToolConfig