mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-25 03:44:09 +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 = {
|
const versionEntry = {
|
||||||
...versionData,
|
...versionData,
|
||||||
...directUpdates,
|
...directUpdates,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { logger } = require('~/config');
|
const { logger } = require('~/config');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -17,14 +17,18 @@ async function uploadAzureDocumentIntelligence({ filePath, apiKey, endpoint, mod
|
||||||
const base64Source = fileBuffer.toString('base64');
|
const base64Source = fileBuffer.toString('base64');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${endpoint}/documentModels/${modelId}/analyze?outputContentFormat=markdown`, {
|
const response = await axios.post(
|
||||||
base64Source,
|
`${endpoint}/documentModels/${modelId}/analyze?outputContentFormat=markdown`,
|
||||||
}, {
|
{
|
||||||
headers: {
|
base64Source,
|
||||||
'Ocp-Apim-Subscription-Key': apiKey,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
|
headers: {
|
||||||
|
'Ocp-Apim-Subscription-Key': apiKey,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
const operationLocation = response.headers['Operation-Location'];
|
const operationLocation = response.headers['Operation-Location'];
|
||||||
|
|
||||||
// Polling for the result
|
// Polling for the result
|
||||||
|
|
|
||||||
|
|
@ -628,6 +628,7 @@ export type TWebSearchConfig = z.infer<typeof webSearchSchema>;
|
||||||
|
|
||||||
export const ocrSchema = z.object({
|
export const ocrSchema = z.object({
|
||||||
mistralModel: z.string().optional(),
|
mistralModel: z.string().optional(),
|
||||||
|
documentIntelligenceModel: z.string().optional(),
|
||||||
apiKey: z.string().optional().default('${OCR_API_KEY}'),
|
apiKey: z.string().optional().default('${OCR_API_KEY}'),
|
||||||
baseURL: z.string().optional().default('${OCR_BASEURL}'),
|
baseURL: z.string().optional().default('${OCR_BASEURL}'),
|
||||||
strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),
|
strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue