mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-31 07:38:52 +01:00
feat: Enhance document intelligence support with new model configuration and API integration
This commit is contained in:
parent
2bf1857bc0
commit
5dfad6b77b
3 changed files with 13 additions and 9 deletions
|
|
@ -278,7 +278,6 @@ const updateAgent = async (searchParameter, updateData, updatingUserId = null) =
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const versionEntry = {
|
||||
...versionData,
|
||||
...directUpdates,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue