Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

👨‍🔧 fix: Direct Provider Attachment Support for Agents (#10035)

Dustin Healyff027e8243ad
diff --git a/api/server/services/Files/process.js b/api/server/services/Files/process.js
index f7220715f6..5e945f0e36 100644
--- a/api/server/services/Files/process.js
+++ b/api/server/services/Files/process.js
@@ -508,7 +508,10 @@ const processAgentFileUpload = async ({ req, res, metadata }) => {
const { file } = req;
const appConfig = req.config;
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');
}
@@ -516,7 +519,6 @@ const processAgentFileUpload = async ({ req, res, metadata }) => {
throw new Error('Image uploads are not supported for file search tool resources');
}
- let messageAttachment = !!metadata.message_file;
if (!messageAttachment && !agent_id) {
throw new Error('No agent ID provided for agent file upload');
}
diff --git a/client/src/components/Chat/Input/Files/AttachFileMenu.tsx b/client/src/components/Chat/Input/Files/AttachFileMenu.tsx
index fa56cdf08b..a3e5a8d304 100644
--- a/client/src/components/Chat/Input/Files/AttachFileMenu.tsx
+++ b/client/src/components/Chat/Input/Files/AttachFileMenu.tsx
@@ -118,7 +118,7 @@ const AttachFileMenu = ({
const currentProvider = provider || endpoint;
- if (isDocumentSupportedProvider(endpointType || currentProvider)) {
+ if (isDocumentSupportedProvider(currentProvider || endpointType)) {
items.push({
label: localize('com_ui_upload_provider'),
onClick: () => {
diff --git a/client/src/hooks/Agents/useAgentToolPermissions.ts b/client/src/hooks/Agents/useAgentToolPermissions.ts
index eea549d7a6..cff9e9635b 100644
--- a/client/src/hooks/Agents/useAgentToolPermissions.ts
+++ b/client/src/hooks/Agents/useAgentToolPermissions.ts
@@ -37,7 +37,10 @@ export default function useAgentToolPermissions(
[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(() => {
// Check ephemeral agent settings