mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(kb): added internal auth for mistral OCR tool via KB (#1704)
This commit is contained in:
@@ -417,11 +417,20 @@ async function parseWithMistralOCR(fileUrl: string, filename: string, mimeType:
|
||||
url = `${getBaseUrl()}${url}`
|
||||
}
|
||||
|
||||
const headers =
|
||||
let headers =
|
||||
typeof mistralParserTool.request!.headers === 'function'
|
||||
? mistralParserTool.request!.headers(params)
|
||||
: mistralParserTool.request!.headers
|
||||
|
||||
if (url.includes('/api/tools/mistral/parse')) {
|
||||
const { generateInternalToken } = await import('@/lib/auth/internal')
|
||||
const internalToken = await generateInternalToken()
|
||||
headers = {
|
||||
...headers,
|
||||
authorization: `Bearer ${internalToken}`,
|
||||
}
|
||||
}
|
||||
|
||||
const requestBody = mistralParserTool.request!.body!(params) as OCRRequestBody
|
||||
return makeOCRRequest(url, headers as Record<string, string>, requestBody)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user