feat: Enhance document intelligence support with new model configuration and API integration

This commit is contained in:
Ruben Talstra 2025-05-24 20:59:22 +02:00
parent 2bf1857bc0
commit 5dfad6b77b
No known key found for this signature in database
GPG key ID: 2A5A7174A60F3BEA
3 changed files with 13 additions and 9 deletions

View file

@ -278,7 +278,6 @@ const updateAgent = async (searchParameter, updateData, updatingUserId = null) =
}
}
const versionEntry = {
...versionData,
...directUpdates,

View file

@ -1,5 +1,5 @@
const axios = require('axios');
const fs = require('fs');
const fs = require('fs');
const { logger } = require('~/config');
/**
@ -17,14 +17,18 @@ async function uploadAzureDocumentIntelligence({ filePath, apiKey, endpoint, mod
const base64Source = fileBuffer.toString('base64');
try {
const response = await axios.post(`${endpoint}/documentModels/${modelId}/analyze?outputContentFormat=markdown`, {
base64Source,
}, {
headers: {
'Ocp-Apim-Subscription-Key': apiKey,
'Content-Type': 'application/json',
const response = await axios.post(
`${endpoint}/documentModels/${modelId}/analyze?outputContentFormat=markdown`,
{
base64Source,
},
});
{
headers: {
'Ocp-Apim-Subscription-Key': apiKey,
'Content-Type': 'application/json',
},
},
);
const operationLocation = response.headers['Operation-Location'];
// Polling for the result

View file

@ -628,6 +628,7 @@ export type TWebSearchConfig = z.infer<typeof webSearchSchema>;
export const ocrSchema = z.object({
mistralModel: z.string().optional(),
documentIntelligenceModel: z.string().optional(),
apiKey: z.string().optional().default('${OCR_API_KEY}'),
baseURL: z.string().optional().default('${OCR_BASEURL}'),
strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),