diff --git a/client/src/components/Chat/Input/Files/AttachFileMenu.tsx b/client/src/components/Chat/Input/Files/AttachFileMenu.tsx index 952b337b3c..6a3f1e96cb 100644 --- a/client/src/components/Chat/Input/Files/AttachFileMenu.tsx +++ b/client/src/components/Chat/Input/Files/AttachFileMenu.tsx @@ -114,6 +114,10 @@ const AttachFileMenu = ({ ephemeralAgent, ); + const isUnifiedMode = + endpointFileConfig?.defaultFileInteraction != null && + endpointFileConfig.defaultFileInteraction !== 'legacy'; + const handleUploadClick = useCallback( (fileType?: FileUploadType) => { if (!inputRef.current) { @@ -139,11 +143,16 @@ const AttachFileMenu = ({ inputRef.current.accept = ''; } inputRef.current.click(); - inputRef.current.accept = ''; }, [endpointFileConfig?.supportedMimeTypes], ); + /** Unified mode: single click triggers file upload with no tool_resource */ + const handleUnifiedUpload = () => { + setToolResource(undefined); + handleUploadClick(); + }; + const dropdownItems = useMemo(() => { const setToolResource = (value: EToolResources | undefined) => { toolResourceRef.current = value; @@ -305,6 +314,47 @@ const AttachFileMenu = ({ } }; + if (isUnifiedMode) { + return ( + <> + { + handleFileChange(e, toolResource); + }} + > + +
+ +
+ + } + id="attach-file-button" + description={localize('com_sidepanel_attach_files')} + disabled={isUploadDisabled} + /> +
+ + + ); + } + return ( <>