From 90c20d2ad68dc65fbb937c0483e71902485ba023 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sat, 21 Mar 2026 18:16:50 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20feat:=20Unified=20file=20upload?= =?UTF-8?q?=20UX=20=E2=80=94=20single=20attach=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 of the unified file experience. When defaultFileInteraction is configured (not 'legacy'), the attach file menu is replaced with a single click-to-upload button that accepts all file types. Files are uploaded without a tool_resource and provisioned lazily at chat time. - AttachFileMenu: render single button in unified mode, legacy dropdown when defaultFileInteraction is 'legacy' - validateFiles: accept union of all supported MIME types (provider + text + ocr + stt) in unified mode - useFileHandling: already supports undefined tool_resource, no changes needed --- .../Chat/Input/Files/AttachFileMenu.tsx | 52 ++++++++++++++++++- client/src/utils/files.ts | 7 ++- 2 files changed, 57 insertions(+), 2 deletions(-) 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 ( <>