diff --git a/src/components/chat/view/subcomponents/CommandResultModal.tsx b/src/components/chat/view/subcomponents/CommandResultModal.tsx index 2e391ebe..d80a97d6 100644 --- a/src/components/chat/view/subcomponents/CommandResultModal.tsx +++ b/src/components/chat/view/subcomponents/CommandResultModal.tsx @@ -2,9 +2,7 @@ import { useMemo, useState } from 'react'; import { Activity, BadgeCheck, - Check, CircleHelp, - Clipboard, Coins, Cpu, Gauge, @@ -59,19 +57,6 @@ type ModelOption = { description?: string; }; -const formatUpdatedAt = (value?: string) => { - if (!value) { - return 'Not cached yet'; - } - - const parsed = new Date(value); - if (Number.isNaN(parsed.getTime())) { - return 'Not cached yet'; - } - - return parsed.toLocaleString(); -}; - const PROVIDER_LABELS: Record = { claude: 'Claude', cursor: 'Cursor', @@ -246,7 +231,6 @@ function HelpContent({ data }: { data: HelpCommandData }) { function ModelsContent({ data, providerModelCatalog, - providerModelCacheCatalog, providerModelsRefreshing, onHardRefreshProviderModels, currentSessionId, @@ -254,14 +238,12 @@ function ModelsContent({ }: { data: ModelCommandData; providerModelCatalog: Partial>; - providerModelCacheCatalog: Partial>; providerModelsRefreshing: boolean; onHardRefreshProviderModels: () => void; currentSessionId: string | null; onSelectProviderModel: CommandResultModalProps['onSelectProviderModel']; }) { const [query, setQuery] = useState(''); - const [copiedModel, setCopiedModel] = useState(null); const [changingModel, setChangingModel] = useState(null); const [pendingSessionModel, setPendingSessionModel] = useState(null); const [selectionNotice, setSelectionNotice] = useState(null); @@ -269,7 +251,6 @@ function ModelsContent({ const currentModel = data?.current?.model || 'Unknown'; const providerLabel = data?.current?.providerLabel || getProviderLabel(currentProvider); const liveDefinition = providerModelCatalog[currentProvider]; - const currentCache = providerModelCacheCatalog[currentProvider] ?? data?.cache; const availableOptions = useMemo(() => { if (liveDefinition?.OPTIONS && liveDefinition.OPTIONS.length > 0) { return liveDefinition.OPTIONS; @@ -282,7 +263,6 @@ function ModelsContent({ const availableModels = Array.isArray(data?.availableModels) ? data.availableModels : []; return availableModels.map((model) => ({ value: model, label: model })); }, [data, liveDefinition]); - const defaultModel = liveDefinition?.DEFAULT || data?.defaultModel || currentModel; const filteredOptions = useMemo(() => { const normalized = query.trim().toLowerCase(); @@ -296,18 +276,8 @@ function ModelsContent({ }); }, [availableOptions, query]); - const activeOption = availableOptions.find((option) => option.value === currentModel); const hasConcreteSessionId = typeof currentSessionId === 'string' && currentSessionId.trim().length > 0; - - const copyModel = (model: string) => { - if (typeof navigator !== 'undefined' && navigator.clipboard) { - void navigator.clipboard.writeText(model).catch(() => undefined); - } - setCopiedModel(model); - window.setTimeout(() => { - setCopiedModel((current) => (current === model ? null : current)); - }, 1300); - }; + const showSearch = availableOptions.length > 6; const handleSelectModel = async (model: string) => { setChangingModel(model); @@ -330,162 +300,106 @@ function ModelsContent({ }; return ( -
-
-
-
-
- - {providerLabel} - - - {availableOptions.length} models - -
- -
-

Active Model

-

- {currentModel} -

- {activeOption?.label && activeOption.label !== currentModel && ( -

{activeOption.label}

- )} - {activeOption?.description && ( -

{activeOption.description}

- )} - {pendingSessionModel && pendingSessionModel !== currentModel && ( -

- Next response: {pendingSessionModel} -

- )} -
-
- -
-
-

Default

-

{defaultModel}

-
-
-

Updated

-

{formatUpdatedAt(currentCache?.updatedAt)}

-
-
- -
-
-

- Catalog Refresh -

- - All providers - -
-

- Model lists are cached for 3 days. Refresh after CLI, auth, or config changes, - or when a new model is missing. -

- -
-
- -
- {hasConcreteSessionId - ? 'Selecting a model stores a session override and applies it on the next response for this session.' - : 'Selecting a model updates the default model used for new turns in this provider.'} - {selectionNotice && {selectionNotice}} +
+ {/* Compact context bar: active model + refresh, no clutter */} +
+
+

+ Active model · {providerLabel} +

+

+ {currentModel} + {pendingSessionModel && pendingSessionModel !== currentModel && ( + + → {pendingSessionModel} next + + )} +

+
-
-
-
- -
- - {filteredOptions.length} shown - -
+ {showSearch && ( + + )} - {filteredOptions.length > 0 ? ( -
-
- {filteredOptions.map((option, index) => { - const isCurrent = option.value === currentModel; - const wasCopied = copiedModel === option.value; - const isPendingSelection = option.value === pendingSessionModel; - const isChanging = option.value === changingModel; - return ( -
- - -
- ); - })} -
+ {filteredOptions.length > 0 ? ( +
+
+ {filteredOptions.map((option, index) => { + const isCurrent = option.value === currentModel; + const isPendingSelection = option.value === pendingSessionModel; + const isChanging = option.value === changingModel; + return ( + + ); + })}
+
+ ) : ( +
+ No models match that search. +
+ )} + + {/* Single quiet line of guidance / feedback */} +

+ {selectionNotice ? ( + {selectionNotice} + ) : hasConcreteSessionId ? ( + 'Your choice applies to this session on the next response.' ) : ( -

- No models match that search. -
+ 'Your choice becomes the default model for new turns.' )} -
+

); } @@ -606,7 +520,6 @@ export default function CommandResultModal({ payload, onClose, providerModelCatalog, - providerModelCacheCatalog, providerModelsRefreshing, onHardRefreshProviderModels, currentSessionId, @@ -624,9 +537,9 @@ export default function CommandResultModal({ icon: CircleHelp, }, models: { - eyebrow: 'Model inventory', - title: 'Available Models', - subtitle: 'Browse, search, and copy model IDs for the active provider.', + eyebrow: 'Model selection', + title: 'Choose a Model', + subtitle: 'Pick the model this provider should use.', icon: Cpu, }, cost: { @@ -700,7 +613,6 @@ export default function CommandResultModal({