From fb72ce4fa11ca1f3252bdf24c489de2d16097752 Mon Sep 17 00:00:00 2001
From: YurenHao0426 <blackhao0426@gmail.com>
Date: Fri, 13 Feb 2026 18:43:35 +0000
Subject: Remove provider badge from file list and add upload indicator to
 right sidebar

- Remove per-provider label from left sidebar file list since files are
  now uploaded to all providers simultaneously
- Add uploading spinner to right sidebar "Upload & Attach" button
- Always upload with provider 'local' from right sidebar settings tab

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
 frontend/src/components/Sidebar.tsx | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

(limited to 'frontend/src/components/Sidebar.tsx')

diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 65d5cd2..f3a0679 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -38,6 +38,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
   const [showAttachModal, setShowAttachModal] = useState(false);
   const [attachSearch, setAttachSearch] = useState('');
   const settingsUploadRef = useRef<HTMLInputElement>(null);
+  const [settingsUploading, setSettingsUploading] = useState(false);
   
   // Response Modal & Edit states
   const [isModalOpen, setIsModalOpen] = useState(false);
@@ -164,22 +165,15 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
   const handleUploadAndAttach = async (e: React.ChangeEvent<HTMLInputElement>) => {
     if (!e.target.files || e.target.files.length === 0 || !selectedNode) return;
     const file = e.target.files[0];
+    setSettingsUploading(true);
     try {
-      // Determine provider based on node model
-      const model = selectedNode.data.model;
-      let provider: 'local' | 'openai' | 'google' = 'local';
-      if (model.startsWith('gpt') || model.startsWith('o1') || model.startsWith('o3')) {
-        provider = 'openai';
-      } else if (model.startsWith('gemini')) {
-        provider = 'google';
-      }
-
-      const meta = await uploadFile(file, { provider });
+      const meta = await uploadFile(file, { provider: 'local' });
       handleAttach(meta.id);
     } catch (err) {
       alert(`Upload failed: ${(err as Error).message}`);
     } finally {
       e.target.value = '';
+      setSettingsUploading(false);
     }
   };
 
@@ -1937,16 +1931,16 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
               <div className="flex gap-2 mb-3">
                 <button
                   onClick={() => settingsUploadRef.current?.click()}
-                  disabled={isGemini}
+                  disabled={isGemini || settingsUploading}
                   className={`flex-1 flex items-center justify-center gap-1.5 py-1.5 px-3 rounded text-xs font-medium transition-colors ${
-                    isGemini
+                    isGemini || settingsUploading
                       ? 'opacity-50 cursor-not-allowed bg-gray-400 text-gray-200'
                       : isDark ? 'bg-blue-600 hover:bg-blue-700 text-white' : 'bg-blue-600 hover:bg-blue-700 text-white'
                   }`}
-                  title={isGemini ? 'Not supported for Gemini models' : 'Upload & Attach'}
+                  title={isGemini ? 'Not supported for Gemini models' : settingsUploading ? 'Uploading...' : 'Upload & Attach'}
                 >
-                  <Upload size={14} />
-                  Upload & Attach
+                  {settingsUploading ? <Loader2 size={14} className="animate-spin" /> : <Upload size={14} />}
+                  {settingsUploading ? 'Uploading...' : 'Upload & Attach'}
                 </button>
                 <input
                   ref={settingsUploadRef}
-- 
cgit v1.2.3

