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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
👥 fix: Collaborative Check Flag for Shared Agent Files (#8516)
Ben Verhees0a169a1ff6c0
diff --git a/api/models/File.js b/api/models/File.jsindex 6d1d77a220..3d735434e3 100644--- a/api/models/File.js+++ b/api/models/File.js@@ -21,7 +21,7 @@ const findFileById = async (file_id, options = {}) => {* @param {string} agentId - The agent ID that might grant access* @returns {Promise<Map<string, boolean>>} Map of fileId to access status*/-const hasAccessToFilesViaAgent = async (userId, fileIds, agentId) => {+const hasAccessToFilesViaAgent = async (userId, fileIds, agentId, checkCollaborative = true) => {const accessMap = new Map();// Initialize all files as no access@@ -55,11 +55,11 @@ const hasAccessToFilesViaAgent = async (userId, fileIds, agentId) => {}// Agent is globally shared - check if it's collaborative- if (!agent.isCollaborative) {+ if (checkCollaborative && !agent.isCollaborative) {return accessMap;}- // Agent is globally shared and collaborative - check which files are actually attached+ // Check which files are actually attachedconst attachedFileIds = new Set();if (agent.tool_resources) {for (const [_resourceType, resource] of Object.entries(agent.tool_resources)) {@@ -118,7 +118,12 @@ const getFiles = async (filter, _sortOptions, selectFields = { text: 0 }, option// Batch check access for all non-owned filesconst fileIds = filesToCheck.map((f) => f.file_id);- const accessMap = await hasAccessToFilesViaAgent(options.userId, fileIds, options.agentId);+ const accessMap = await hasAccessToFilesViaAgent(+ options.userId,+ fileIds,+ options.agentId,+ false,+ );// Filter files based on accessconst accessibleFiles = filesToCheck.filter((file) => accessMap.get(file.file_id));