From a6ae179f43e1e5c6d8e372f6ec4b4c6b2f8c0b15 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Fri, 26 Jun 2026 18:55:44 -0500 Subject: [PATCH] fix(desktop): show custom (non-curated) model in Settings model pickers A Radix renders a blank trigger when `value` matches no . +// A custom model (e.g. one added via config that isn't in the provider's +// curated list) would vanish — surface the active value so it stays selectable. +export const withActive = (models: readonly string[], active: string): readonly string[] => + active && !models.includes(active) ? [active, ...models] : models + interface StaleAuxWarningProps { applying: boolean onReset: () => void @@ -555,7 +561,7 @@ export function ModelSettings({ onMainModelChanged }: ModelSettingsProps) { - {(selectedProviderModels.length ? selectedProviderModels : []).map(model => ( + {withActive(selectedProviderModels, selectedModel).map(model => ( {model} @@ -708,7 +714,7 @@ export function ModelSettings({ onMainModelChanged }: ModelSettingsProps) { - {(auxDraftProviderModels.length ? auxDraftProviderModels : []).map(model => ( + {withActive(auxDraftProviderModels, auxDraft.model).map(model => ( {model} @@ -880,7 +886,7 @@ export function ModelSettings({ onMainModelChanged }: ModelSettingsProps) { - {modelsForProvider(slot.provider).map(model => ( + {withActive(modelsForProvider(slot.provider), slot.model).map(model => ( {model} @@ -957,7 +963,10 @@ export function ModelSettings({ onMainModelChanged }: ModelSettingsProps) { - {modelsForProvider(currentMoaPreset.aggregator.provider).map(model => ( + {withActive( + modelsForProvider(currentMoaPreset.aggregator.provider), + currentMoaPreset.aggregator.model + ).map(model => ( {model} diff --git a/apps/desktop/src/app/settings/with-active.test.ts b/apps/desktop/src/app/settings/with-active.test.ts new file mode 100644 index 00000000000..6a2ce5703d8 --- /dev/null +++ b/apps/desktop/src/app/settings/with-active.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from 'vitest' + +import { withActive } from './model-settings' + +// A Radix