diff --git a/frontend/src/components/thread/chat-input/model-selector.tsx b/frontend/src/components/thread/chat-input/model-selector.tsx index e66c7046..5c1cf8b4 100644 --- a/frontend/src/components/thread/chat-input/model-selector.tsx +++ b/frontend/src/components/thread/chat-input/model-selector.tsx @@ -25,7 +25,7 @@ import { TooltipTrigger, } from '@/components/ui/tooltip'; import { Button } from '@/components/ui/button'; -import { Check, Search, AlertTriangle, Crown, ArrowUpRight, Brain, Plus, Edit, Trash, Cpu, KeyRound, ExternalLink, Settings } from 'lucide-react'; +import { Check, Search, AlertTriangle, Crown, ArrowUpRight, Brain, Plus, Edit, Trash, Cpu, KeyRound, ExternalLink } from 'lucide-react'; import { ModelOption, SubscriptionStatus, @@ -144,7 +144,6 @@ export const ModelSelector: React.FC = ({ const { data: agent } = useAgent(selectedAgentId || ''); const { data: profiles } = useComposioProfiles(); - // Feature flag for custom agents const { enabled: customAgentsEnabled } = useFeatureFlag('custom_agents'); const isAppConnectedToAgent = (appSlug: string): boolean => { @@ -556,191 +555,153 @@ export const ModelSelector: React.FC = ({ className="w-72 p-0 overflow-hidden" sideOffset={4} > -
- {shouldDisplayAll ? ( -
-
- Available Models -
- {uniqueModels - .filter(m => - !m.requiresSubscription && - (m.label.toLowerCase().includes(searchQuery.toLowerCase()) || - m.id.toLowerCase().includes(searchQuery.toLowerCase())) - ) - .map((model, index) => ( - - - -
- onModelChange(model.id)} - onMouseEnter={() => setHighlightedIndex(filteredOptions.indexOf(model))} - > -
- {model.label} -
-
- {(MODELS[model.id]?.lowQuality || false) && ( - - )} - {(MODELS[model.id]?.recommended || false) && ( - - Recommended - - )} - {selectedModel === model.id && ( - - )} -
-
-
-
- {MODELS[model.id]?.lowQuality && ( - -

Basic model with limited capabilities

-
- )} -
-
- )) - } -
-
- - Additional Models -
-
- {getPremiumModels() - .filter(m => - m.requiresSubscription && - (m.label.toLowerCase().includes(searchQuery.toLowerCase()) || - m.id.toLowerCase().includes(searchQuery.toLowerCase())) - ) - .slice(0, 3) - .map((model, index) => ( - - - -
- +
+ + + + Models + + + +
+ All Models + {isLocalMode() && ( +
+ + + + -
- {model.label} + + + + + Local .Env Manager + + + + + + + + + + Add a custom model + + + +
+ )} +
+
+
+ + setSearchQuery(e.target.value)} + onKeyDown={handleSearchInputKeyDown} + className="w-full h-8 px-8 py-1 rounded-lg text-sm focus:outline-none bg-muted" + /> +
+
+ + {shouldDisplayAll ? ( +
+
+ Available Models +
+ {uniqueModels + .filter(m => + !m.requiresSubscription && + (m.label.toLowerCase().includes(searchQuery.toLowerCase()) || + m.id.toLowerCase().includes(searchQuery.toLowerCase())) + ) + .map((model, index) => renderModelOption(model, index))} + +
+
+ + Additional Models +
+
+ {getPremiumModels() + .filter(m => + m.requiresSubscription && + (m.label.toLowerCase().includes(searchQuery.toLowerCase()) || + m.id.toLowerCase().includes(searchQuery.toLowerCase())) + ) + .slice(0, 3) + .map((model, index) => ( + + + +
+ +
+ {model.label} +
+
+ {MODELS[model.id]?.recommended && ( + + Recommended + + )} + +
+
+
+
+ +

Requires subscription to access premium model

+
+
+
+ )) + } +
+
+
+
+
+ +
+

Unlock all models + higher limits

+
+
+
-
- {MODELS[model.id]?.recommended && ( - - Recommended - - )} - -
- -
- - -

Requires subscription to access premium model

-
- - - )) - } -
-
-
-
-
- -
-

Unlock all models + higher limits

+
-
-
-
-
-
- ) : ( -
-
- - - - Models - - - -
- All Models - {isLocalMode() && ( -
- - - - - - - - - Local .Env Manager - - - - - - - - - - Add a custom model - - - -
- )} -
-
-
- - setSearchQuery(e.target.value)} - onKeyDown={handleSearchInputKeyDown} - className="w-full h-8 px-8 py-1 rounded-lg text-sm focus:outline-none bg-muted" - /> -
-
+ ) : ( +
{uniqueModels .filter(m => m.label.toLowerCase().includes(searchQuery.toLowerCase()) || @@ -752,131 +713,129 @@ export const ModelSelector: React.FC = ({ No models match your search
)} -
-
-
- - {/* Quick Connect Apps Submenu - only show if custom_agents is enabled */} - {customAgentsEnabled && ( - - -
- - Quick Connect -
-
- {googleDriveIcon?.icon_url && slackIcon?.icon_url && notionIcon?.icon_url ? ( - <> - Google Drive - Slack - Notion - - ) : ( - <> - - - - - )} -
-
- - -
- Popular Apps -
-
- {!selectedAgentId || !agent || !profiles ? ( - <> - {Array.from({ length: 4 }).map((_, index) => ( -
-
- - -
- +
+ )} + + + + {customAgentsEnabled && ( + + +
+ + Quick Connect +
+
+ {googleDriveIcon?.icon_url && slackIcon?.icon_url && notionIcon?.icon_url ? ( + <> + Google Drive + Slack + Notion + + ) : ( + <> + + + + + )} +
+
+ + +
+ Popular Apps +
+
+ {!selectedAgentId || !agent || !profiles ? ( + <> + {Array.from({ length: 4 }).map((_, index) => ( +
+
+ +
- ))} - - ) : ( - PREDEFINED_APPS.map((app) => { - const isConnected = isAppConnectedToAgent(app.slug); - return ( - - - - +
+ ))} + + ) : ( + PREDEFINED_APPS.map((app) => { + const isConnected = isAppConnectedToAgent(app.slug); + return ( + + + + handleAppSelect(app)} + disabled={isConnected} + > +
+ {appIconMap[app.slug] ? ( + {app.name} + ) : ( +
+ {app.name.charAt(0)} +
)} - onClick={isConnected ? undefined : () => handleAppSelect(app)} - disabled={isConnected} - > -
- {appIconMap[app.slug] ? ( - {app.name} - ) : ( -
- {app.name.charAt(0)} -
- )} - {app.name} - {isConnected && ( - - Connected - - )} -
-
- {isConnected ? ( - - ) : ( - - )} -
- - - -

{isConnected ? `Manage ${app.name} tools` : app.description}

-
- - - ); - }) - )} -
- -
- - - - -
- - Discover more apps -
- -
-
- -

Open full integrations manager

-
-
-
-
- - - - )} -
-
- )} + {app.name} + {isConnected && ( + + Connected + + )} +
+
+ {isConnected ? ( + + ) : ( + + )} +
+ + + +

{isConnected ? `Manage ${app.name} tools` : app.description}

+
+ + + ); + }) + )} +
+ +
+ + + + +
+ + Discover more apps +
+ +
+
+ +

Open full integrations manager

+
+
+
+
+ + + + )} +