🎯 fix: Use Agents Endpoint Config for Agent Panel File Upload Validation (#11992)

* fix: Use correct endpoint for file validation in agent panel uploads

  Agent panel file uploads (FileSearch, FileContext, Code/Files) were validating against the active conversation's endpoint config instead of the agents endpoint config. This caused incorrect file size limits when the active chat used a different endpoint.

  Add endpointOverride option to useFileHandling so callers can specify the correct endpoint for validation independent of the active conversation.

* fix: Use agents endpoint config for agent panel file upload validation

Agent panel file uploads (FileSearch, FileContext, Code/Files) validated
against the active conversation's endpoint config instead of the agents
endpoint config. This caused wrong file size limits when the active chat
used a different endpoint.

Adds endpointOverride to useFileHandling so callers can specify the
correct endpoint for both validation and upload routing, independent of
the active conversation.

* test: Add unit tests for useFileHandling hook to validate endpoint overrides

Introduced comprehensive tests for the useFileHandling hook, ensuring correct behavior when using endpoint overrides for file validation and upload routing. The tests cover various scenarios, including fallback to conversation endpoints and proper handling of agent-specific configurations, enhancing the reliability of file handling in the application.
This commit is contained in:
Danny Avila 2026-02-28 15:01:51 -05:00 committed by GitHub
parent 43ff3f8473
commit cde5079886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 304 additions and 3 deletions

View file

@ -47,10 +47,12 @@ export default function FileContext({
const { handleFileChange } = useFileHandling({
additionalMetadata: { agent_id, tool_resource: EToolResources.context },
endpointOverride: EModelEndpoint.agents,
fileSetter: setFiles,
});
const { handleSharePointFiles, isProcessing, downloadProgress } = useSharePointFileHandling({
additionalMetadata: { agent_id, tool_resource: EToolResources.file_search },
endpointOverride: EModelEndpoint.agents,
fileSetter: setFiles,
});
useLazyEffect(