mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
👨🔧 fix: Direct Provider Attachment Support for Agents (#10035)
* fix: show direct upload option on applicable agents * fix: allow agent file upload handler to process direct upload files (no tool_resource)
This commit is contained in:
parent
e9b678dd6a
commit
ff027e8243
3 changed files with 9 additions and 4 deletions
|
|
@ -508,7 +508,10 @@ const processAgentFileUpload = async ({ req, res, metadata }) => {
|
||||||
const { file } = req;
|
const { file } = req;
|
||||||
const appConfig = req.config;
|
const appConfig = req.config;
|
||||||
const { agent_id, tool_resource, file_id, temp_file_id = null } = metadata;
|
const { agent_id, tool_resource, file_id, temp_file_id = null } = metadata;
|
||||||
if (agent_id && !tool_resource) {
|
|
||||||
|
let messageAttachment = !!metadata.message_file;
|
||||||
|
|
||||||
|
if (agent_id && !tool_resource && !messageAttachment) {
|
||||||
throw new Error('No tool resource provided for agent file upload');
|
throw new Error('No tool resource provided for agent file upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -516,7 +519,6 @@ const processAgentFileUpload = async ({ req, res, metadata }) => {
|
||||||
throw new Error('Image uploads are not supported for file search tool resources');
|
throw new Error('Image uploads are not supported for file search tool resources');
|
||||||
}
|
}
|
||||||
|
|
||||||
let messageAttachment = !!metadata.message_file;
|
|
||||||
if (!messageAttachment && !agent_id) {
|
if (!messageAttachment && !agent_id) {
|
||||||
throw new Error('No agent ID provided for agent file upload');
|
throw new Error('No agent ID provided for agent file upload');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ const AttachFileMenu = ({
|
||||||
|
|
||||||
const currentProvider = provider || endpoint;
|
const currentProvider = provider || endpoint;
|
||||||
|
|
||||||
if (isDocumentSupportedProvider(endpointType || currentProvider)) {
|
if (isDocumentSupportedProvider(currentProvider || endpointType)) {
|
||||||
items.push({
|
items.push({
|
||||||
label: localize('com_ui_upload_provider'),
|
label: localize('com_ui_upload_provider'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ export default function useAgentToolPermissions(
|
||||||
[agentData?.tools, selectedAgent?.tools],
|
[agentData?.tools, selectedAgent?.tools],
|
||||||
);
|
);
|
||||||
|
|
||||||
const provider = useMemo(() => selectedAgent?.provider, [selectedAgent?.provider]);
|
const provider = useMemo(
|
||||||
|
() => agentData?.provider || selectedAgent?.provider,
|
||||||
|
[agentData?.provider, selectedAgent?.provider],
|
||||||
|
);
|
||||||
|
|
||||||
const fileSearchAllowedByAgent = useMemo(() => {
|
const fileSearchAllowedByAgent = useMemo(() => {
|
||||||
// Check ephemeral agent settings
|
// Check ephemeral agent settings
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue