import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { Brain, Terminal } from 'lucide-react'; import { cn } from '@/lib/utils'; import type { ModelAlias, ThinkingLevel, AIProfile, CursorModelId } from '@automaker/types'; import { CURSOR_MODEL_MAP, profileHasThinking, PROVIDER_PREFIXES } from '@automaker/types'; import { PROFILE_ICONS } from './model-constants'; /** * Get display string for a profile's model configuration */ function getProfileModelDisplay(profile: AIProfile): string { if (profile.provider === 'cursor') { const cursorModel = profile.cursorModel || 'auto'; const modelConfig = CURSOR_MODEL_MAP[cursorModel]; return modelConfig?.label || cursorModel; } // Claude return profile.model || 'sonnet'; } /** * Get display string for a profile's thinking configuration */ function getProfileThinkingDisplay(profile: AIProfile): string | null { if (profile.provider === 'cursor') { // For Cursor, thinking is embedded in the model return profileHasThinking(profile) ? 'thinking' : null; } // Claude return profile.thinkingLevel && profile.thinkingLevel !== 'none' ? profile.thinkingLevel : null; } interface ProfileSelectProps { profiles: AIProfile[]; selectedModel: ModelAlias | CursorModelId; selectedThinkingLevel: ThinkingLevel; selectedCursorModel?: string; // For detecting cursor profile selection onSelect: (profile: AIProfile) => void; testIdPrefix?: string; className?: string; disabled?: boolean; } /** * ProfileSelect - Compact dropdown selector for AI profiles * * A lightweight alternative to ProfileQuickSelect for contexts where * space is limited (e.g., mass edit, bulk operations). * * Shows icon + profile name in dropdown, with model details below. * * @example * ```tsx * * ``` */ export function ProfileSelect({ profiles, selectedModel, selectedThinkingLevel, selectedCursorModel, onSelect, testIdPrefix = 'profile-select', className, disabled = false, }: ProfileSelectProps) { if (profiles.length === 0) { return null; } // Check if a profile is selected const isProfileSelected = (profile: AIProfile): boolean => { if (profile.provider === 'cursor') { // For cursor profiles, check if cursor model matches const profileCursorModel = `${PROVIDER_PREFIXES.cursor}${profile.cursorModel || 'auto'}`; return selectedCursorModel === profileCursorModel; } // For Claude profiles return selectedModel === profile.model && selectedThinkingLevel === profile.thinkingLevel; }; const selectedProfile = profiles.find(isProfileSelected); return (
{selectedProfile && (

{getProfileModelDisplay(selectedProfile)} {getProfileThinkingDisplay(selectedProfile) && ` + ${getProfileThinkingDisplay(selectedProfile)}`}

)}
); }