mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🔧 fix(assistants): Vision minor fix & Add Docs (#2196)
* 👓 fix(assistants): Only Retrieve Assistant Data for Vision Requests if attachments exist in Host Storage
* docs: add capability
This commit is contained in:
parent
798e8763d0
commit
f86d80de59
3 changed files with 33 additions and 25 deletions
|
|
@ -363,16 +363,24 @@ router.post('/', validateModel, buildEndpointOption, setHeaders, async (req, res
|
|||
return;
|
||||
}
|
||||
|
||||
/** @type {MongoFile[]} */
|
||||
const attachments = await req.body.endpointOption.attachments;
|
||||
if (
|
||||
attachments &&
|
||||
attachments.every((attachment) => attachment.source === FileSources.openai)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const assistant = await openai.beta.assistants.retrieve(assistant_id);
|
||||
const visionToolIndex = assistant.tools.findIndex(
|
||||
(tool) => tool.function.name === ImageVisionTool.function.name,
|
||||
(tool) => tool?.function && tool?.function?.name === ImageVisionTool.function.name,
|
||||
);
|
||||
|
||||
if (visionToolIndex === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const attachments = await req.body.endpointOption.attachments;
|
||||
let visionMessage = {
|
||||
role: 'user',
|
||||
content: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue