Skip to content

The agent that grows with you

fix(desktop): align main model settings controls

abundantbeingab3fe9dffb0a
diff --git a/apps/desktop/src/app/settings/model-settings.test.tsx b/apps/desktop/src/app/settings/model-settings.test.tsx
index 447af0b6960..d31ac3801a7 100644
--- a/apps/desktop/src/app/settings/model-settings.test.tsx
+++ b/apps/desktop/src/app/settings/model-settings.test.tsx
@@ -137,6 +137,16 @@ describe('ModelSettings profile scope', () => {
})
describe('ModelSettings', () => {
+ it('labels the main provider, model and default controls independently', async () => {
+ renderModelSettings()
+
+ expect(await screen.findByRole('combobox', { name: 'Provider' })).toBeTruthy()
+ expect(screen.getByRole('combobox', { name: 'Model' })).toBeTruthy()
+ expect(await screen.findByRole('combobox', { name: 'Reasoning' })).toBeTruthy()
+ expect(screen.getByText('Provider', { exact: true })).toBeTruthy()
+ expect(screen.getByText('Model', { exact: true })).toBeTruthy()
+ expect(setModelAssignment).not.toHaveBeenCalled()
+ })
it.each(['custom', 'local', 'custom:lab'])(
'opens local endpoint setup when %s has no inventory row',
async provider => {
diff --git a/apps/desktop/src/app/settings/model-settings.tsx b/apps/desktop/src/app/settings/model-settings.tsx
index d36650a76b8..955f060027b 100644
--- a/apps/desktop/src/app/settings/model-settings.tsx
+++ b/apps/desktop/src/app/settings/model-settings.tsx
@@ -66,15 +66,17 @@ export function ModelSettingsSkeleton({ subpage }: Pick<ModelSettingsProps, 'sub
{(subpage === undefined || subpage === 'main') && (
<section>
<Skeleton className="mb-3 h-3 w-72 max-w-full" />
- <div className="flex flex-wrap items-center gap-2">
- <Skeleton className="h-8 w-40" />
- <Skeleton className="h-8 w-60 max-w-full" />
+ <div className="grid gap-1">
+ <ListRowSkeleton />
+ <ListRowSkeleton />
+ </div>
+ <div className="flex justify-end pt-1">
<Skeleton className="h-8 w-16" />
</div>
- <div className="mt-3 flex flex-wrap items-center gap-x-6 gap-y-3">
- <Skeleton className="h-3 w-16" />
- <Skeleton className="h-8 w-28" />
- <Skeleton className="h-6 w-20" />
+ <div className="mt-6 grid gap-1">
+ <Skeleton className="mb-1 h-3 w-16" />
+ <ListRowSkeleton />
+ <ListRowSkeleton />
</div>
</section>
)}
@@ -296,6 +298,83 @@ interface ModelSettingsProps {
scopeProfile?: string
}
+function MainModelDefaults({
+ effortValue,
+ fastOn,
+ fastSupported,
+ onChange,
+ reasoningSupported,
+ speedValue,
+ ultrafastSupported
+}: {
+ effortValue: string
+ fastOn: boolean
+ fastSupported: boolean
+ onChange: (key: string, value: boolean | string) => Promise<void>
+ reasoningSupported: boolean
+ speedValue: SpeedTier
+ ultrafastSupported: boolean
+}) {
+ const { t } = useI18n()
+ const m = t.settings.model
+
+ return (
+ <div className="mt-6 grid gap-1">
+ <p className="mb-1 text-xs text-muted-foreground">{m.defaultsLabel}</p>
+ {reasoningSupported && (
+ <ListRow
+ action={
+ <Select onValueChange={value => void onChange('agent.reasoning_effort', value)} value={effortValue}>
+ <SelectTrigger aria-label={m.reasoning} className={cn('min-w-28', CONTROL_TEXT)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {REASONING_EFFORT_VALUES.map(value => (
+ <SelectItem key={value} value={value}>
+ {value === 'none' ? m.reasoningOff : t.shell.modelOptions[value]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ }
+ title={m.reasoning}
+ />
+ )}
+ {ultrafastSupported ? (
+ <ListRow
+ action={
+ <Select onValueChange={value => void onChange('agent.service_tier', value)} value={speedValue}>
+ <SelectTrigger aria-label={m.speed} className={cn('min-w-28', CONTROL_TEXT)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="normal">{m.speedStandard}</SelectItem>
+ {fastSupported && <SelectItem value="fast">{t.shell.modelOptions.fast}</SelectItem>}
+ <SelectItem value="ultrafast">{t.shell.modelOptions.ultrafast}</SelectItem>
+ </SelectContent>
+ </Select>
+ }
+ title={m.speed}
+ />
+ ) : (
+ fastSupported && (
+ <ListRow
+ action={
+ <Switch
+ aria-label={t.shell.modelOptions.fast}
+ checked={fastOn}
+ onCheckedChange={checked => void onChange('agent.service_tier', checked ? 'fast' : 'normal')}
+ size="xs"
+ />
+ }
+ title={t.shell.modelOptions.fast}
+ />
+ )
+ )}
+ </div>
+ )
+}
+
export function ModelSettings({ onMainModelChanged, scopeProfile, subpage }: ModelSettingsProps) {
const { t } = useI18n()
const m = t.settings.model
@@ -997,70 +1076,89 @@ export function ModelSettings({ onMainModelChanged, scopeProfile, subpage }: Mod
{showMain && (
<section>
<p className="mb-3 text-xs text-muted-foreground">{m.appliesDesc}</p>
- <div className="flex flex-wrap items-center gap-2">
- <Select onValueChange={switchProvider} value={selectedProviderRow?.slug ?? selectedProvider}>
- <SelectTrigger className={cn('min-w-40', CONTROL_TEXT)}>
- <SelectValue placeholder={m.provider} />
- </SelectTrigger>
- <SelectContent>
- {mainProviderOptions.map(provider => (
- <SelectItem key={provider.slug || 'none'} value={provider.slug || 'none'}>
- {provider.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {needsSetup ? (
- setupIsApiKey ? (
- <>
- <Input
- autoComplete="off"
- className={cn('min-w-60 flex-1', CONTROL_TEXT)}
- onChange={event => setApiKeyDraft(event.target.value)}
- onKeyDown={event => {
- if (isSubmitEnter(event)) {
- void activateApiKeyProvider()
- }
- }}
- placeholder={`Paste ${selectedProviderRow?.key_env ?? 'API key'}`}
- type="password"
- value={apiKeyDraft}
- />
- <Button
- disabled={!apiKeyDraft.trim() || activating}
- onClick={() => void activateApiKeyProvider()}
- size="sm"
+ <div className="grid gap-1">
+ <ListRow
+ action={
+ <Select onValueChange={switchProvider} value={selectedProviderRow?.slug ?? selectedProvider}>
+ <SelectTrigger
+ aria-label={m.provider}
+ className={cn(
+ 'w-full min-w-0 max-w-full @2xl:w-72 [&_[data-slot=select-value]]:truncate',
+ CONTROL_TEXT
+ )}
>
- {activating && <Loader2 className="size-3.5 animate-spin" />}
- {activating ? 'Activating...' : 'Activate'}
- </Button>
- </>
- ) : (
- <Button onClick={startProviderSetup} size="sm" variant="textStrong">
- {m.setUpProvider(selectedProviderRow?.name ?? m.setupProviderFallback)}
- </Button>
- )
- ) : (
- <>
- <ModelSelect
- className="min-w-60"
- models={selectedProviderModels}
- onValueChange={setSelectedModel}
- provider={selectedProviderRow}
- providerSlug={selectedProvider}
- value={selectedModel}
- />
- <Button
- disabled={!selectedProvider || !selectedModel || applying}
- onClick={() => void applyMainModel()}
- size="sm"
- >
- {applying && <Loader2 className="size-3.5 animate-spin" />}
- {applying ? m.applying : t.common.apply}
- </Button>
- </>
- )}
+ <SelectValue placeholder={m.provider} />
+ </SelectTrigger>
+ <SelectContent>
+ {mainProviderOptions.map(provider => (
+ <SelectItem key={provider.slug || 'none'} value={provider.slug || 'none'}>
+ {provider.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ }
+ title={m.provider}
+ />
+ <ListRow
+ action={
+ needsSetup ? (
+ setupIsApiKey ? (
+ <div className="grid w-full min-w-0 max-w-full @2xl:w-72 justify-items-end gap-2">
+ <Input
+ autoComplete="off"
+ className={cn('min-w-0', CONTROL_TEXT)}
+ onChange={event => setApiKeyDraft(event.target.value)}
+ onKeyDown={event => {
+ if (isSubmitEnter(event)) {
+ void activateApiKeyProvider()
+ }
+ }}
+ placeholder={`Paste ${selectedProviderRow?.key_env ?? 'API key'}`}
+ type="password"
+ value={apiKeyDraft}
+ />
+ <Button
+ disabled={!apiKeyDraft.trim() || activating}
+ onClick={() => void activateApiKeyProvider()}
+ size="sm"
+ >
+ {activating && <Loader2 className="size-3.5 animate-spin" />}
+ {activating ? 'Activating...' : 'Activate'}
+ </Button>
+ </div>
+ ) : (
+ <Button onClick={startProviderSetup} size="sm" variant="textStrong">
+ {m.setUpProvider(selectedProviderRow?.name ?? m.setupProviderFallback)}
+ </Button>
+ )
+ ) : (
+ <ModelSelect
+ aria-label={m.model}
+ className="w-full min-w-0 max-w-full @2xl:w-72 [&_[data-slot=select-value]]:truncate"
+ models={selectedProviderModels}
+ onValueChange={setSelectedModel}
+ provider={selectedProviderRow}
+ providerSlug={selectedProvider}
+ value={selectedModel}
+ />
+ )
+ }
+ title={m.model}
+ />
</div>
+ {!needsSetup && (
+ <div className="flex justify-end pt-1">
+ <Button
+ disabled={!selectedProvider || !selectedModel || applying}
+ onClick={() => void applyMainModel()}
+ size="sm"
+ >
+ {applying && <Loader2 className="size-3.5 animate-spin" />}
+ {applying ? m.applying : t.common.apply}
+ </Button>
+ </div>
+ )}
{needsSetup && !setupIsApiKey && selectedProviderRow && (
<p className="mt-2 text-xs text-muted-foreground">
{selectedProviderRow?.auth_type === 'api_key'
@@ -1069,60 +1167,15 @@ export function ModelSettings({ onMainModelChanged, scopeProfile, subpage }: Mod
</p>
)}
{config && mainModel && (reasoningSupported || fastSupported || ultrafastSupported) && (
- <div className="mt-3 flex flex-wrap items-center gap-x-6 gap-y-3">
- <span className="text-xs text-muted-foreground">{m.defaultsLabel}</span>
- {reasoningSupported && (
- <div className="flex items-center gap-2 text-xs">
- <span className="shrink-0 whitespace-nowrap">{m.reasoning}</span>
- <Select
- onValueChange={value => void writeAgentDefault('agent.reasoning_effort', value)}
- value={effortValue}
- >
- <SelectTrigger className={cn('min-w-28', CONTROL_TEXT)}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {REASONING_EFFORT_VALUES.map(value => (
- <SelectItem key={value} value={value}>
- {value === 'none' ? m.reasoningOff : t.shell.modelOptions[value]}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- )}
- {ultrafastSupported ? (
- <div className="flex items-center gap-2 text-xs">
- <span className="shrink-0 whitespace-nowrap">{m.speed}</span>
- <Select
- onValueChange={value => void writeAgentDefault('agent.service_tier', value)}
- value={speedValue}
- >
- <SelectTrigger aria-label={m.speed} className={cn('min-w-28', CONTROL_TEXT)}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="normal">{m.speedStandard}</SelectItem>
- {fastSupported && <SelectItem value="fast">{t.shell.modelOptions.fast}</SelectItem>}
- <SelectItem value="ultrafast">{t.shell.modelOptions.ultrafast}</SelectItem>
- </SelectContent>
- </Select>
- </div>
- ) : (
- fastSupported && (
- <label className="flex items-center gap-2 text-xs">
- {t.shell.modelOptions.fast}
- <Switch
- checked={fastOn}
- onCheckedChange={checked =>
- void writeAgentDefault('agent.service_tier', checked ? 'fast' : 'normal')
- }
- size="xs"
- />
- </label>
- )
- )}
- </div>
+ <MainModelDefaults
+ effortValue={effortValue}
+ fastOn={fastOn}
+ fastSupported={fastSupported}
+ onChange={writeAgentDefault}
+ reasoningSupported={reasoningSupported}
+ speedValue={speedValue}
+ ultrafastSupported={ultrafastSupported}
+ />
)}
{errorNotice}
{switchStaleAux.length > 0 && (
diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.md
index 4c8ee2e0c56..811c68edd34 100644
--- a/website/docs/user-guide/desktop.md
+++ b/website/docs/user-guide/desktop.md
@@ -104,7 +104,7 @@ The model picker lives in the **composer**, just left of the microphone. Click i
The **microphone** is dictation; hover it and the other voice toggles fan out above it — **Read replies aloud** and the **wake word** ear. A toggle that is on shows as a solid disc. Starting a full voice conversation stays on the primary button to the right. In the HUD and in narrow tiles the same controls fold into one menu behind the mic instead. When dictation talks to the speech-to-text provider directly (client-direct voice), the request honours the same `stt.openai.timeout` budget (default 60 s) as the gateway's own transcription client, so a slow endpoint fails with "Transcription timed out" instead of leaving the mic stuck on transcribing.
- **The composer picker is sticky UI state and never touches your default.** It's remembered locally (per device) and **follows** across new chats and restarts instead of snapping back to the default — pick a model once and the next `Cmd/Ctrl+N` opens on it. With a live chat, switching models scopes the change to that **current chat**; either way the selection rides along when the session is created/switched and is **never** written to the profile default — with one exception: on a fresh profile that has no `model.default`/`model.provider` configured yet, the first pick is persisted so the app has a real default instead of falling through to a stray API-key env var on restart. Persistence follows the same rule as `/model` (`model.persist_switch_by_default`); use **Settings → Model** to change the default deliberately. (Switching [profiles](#sessions--profiles) reseeds to that profile's own default.)
-- **Set the default in Settings → Model.** That "main" model is your **per-profile global default** — it's what new chats, crons, subagents, and auxiliary tasks start from, and it's the only place that writes it. Each [profile](#sessions--profiles) keeps its own default.
+- **Set the default in Settings → Model → Main model.** Choose a provider and model in their labeled rows, then click **Apply** below the model selector. Controls align to the right on wide windows and stack below their labels on narrow windows. The **Defaults** section has separate reasoning and speed controls where the model supports them. That "main" model is your **per-profile global default**, which new chats, crons, subagents, and auxiliary tasks start from. Each [profile](#sessions--profiles) keeps its own default.
- **Per-model effort/fast presets.** Each model remembers its own reasoning effort and fast-mode choice in the desktop app, re-applied to the session whenever you pick that model. These presets are a desktop convenience and don't change crons or subagents.
- **Favorite models.** Click the star on the left of a model row (or shift-click the row, the same gesture that pins a chat in the sidebar; Shift+Enter from the search box) to lift it into a **Favorites** section at the top of the picker. Starring never selects the model or closes the menu, so the same gesture undoes it. The section only appears once something is starred. Favorites show in the composer, in session tiles, and anywhere else a model is picked, because they are one stored preference. They persist per device, keep the order you starred them, and ignore the **Edit models** shortlist (a star IS an explicit "always show me this one"); a favorite for a provider that is not connected is kept and reappears when it reconnects. Searching is unaffected — a query lists every match in its provider's place.
- **Mid-chat switches reset the prompt cache.** Switching the model inside a live chat means the next message re-reads the whole conversation at full input price (provider prompt caches are keyed to the model). Fine occasionally; on a long chat, a fresh chat on the new model is often cheaper than bouncing back and forth.