Skip to content

Commit 26ddda2

Browse files
kr4chininclaude
andcommitted
fix(settings): choosing the fallback as the text generation model turns the fallback off
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 6a72782 commit 26ddda2

1 file changed

Lines changed: 27 additions & 12 deletions

File tree

‎apps/web/src/components/settings/SettingsPanels.tsx‎

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type DesktopUpdateChannel,
99
IDLE_COMPACTION_MODES,
1010
globalIdleCompaction,
11+
type ModelSelection,
1112
ProviderDriverKind,
1213
type ProviderInstanceId,
1314
type SidebarProjectGroupingMode,
@@ -893,6 +894,19 @@ export function GeneralSettingsPanel() {
893894
instanceId === textGenInstanceId && model === textGenModel
894895
? "This is already the text generation model."
895896
: textGenerationModelDisabledReason(instanceId, model);
897+
// For the same reason, a primary model that lands on the fallback turns the
898+
// fallback off rather than leaving a switch on that never retries.
899+
const textGenerationModelPatch = (selection: ModelSelection) => {
900+
const fallback = settings.textGenerationFallbackModelSelection;
901+
return {
902+
textGenerationModelSelection: selection,
903+
...(fallback &&
904+
fallback.instanceId === selection.instanceId &&
905+
fallback.model === selection.model
906+
? { textGenerationFallbackModelSelection: null }
907+
: {}),
908+
};
909+
};
896910
const textGenerationFallbackInstanceEntry = textGenerationModelInstanceEntries.find(
897911
(entry) => entry.instanceId === textGenerationFallbackSelection.instanceId,
898912
);
@@ -1859,10 +1873,9 @@ export function GeneralSettingsPanel() {
18591873
<SettingResetButton
18601874
label="text generation model"
18611875
onClick={() =>
1862-
updateSettings({
1863-
textGenerationModelSelection:
1864-
DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection,
1865-
})
1876+
updateSettings(
1877+
textGenerationModelPatch(DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection),
1878+
)
18661879
}
18671880
/>
18681881
) : null
@@ -1908,15 +1921,17 @@ export function GeneralSettingsPanel() {
19081921
});
19091922
return;
19101923
}
1911-
updateSettings({
1912-
textGenerationModelSelection: resolveAppModelSelectionState(
1913-
{
1914-
...settings,
1915-
textGenerationModelSelection: createModelSelection(instanceId, model),
1916-
},
1917-
textGenerationProviders,
1924+
updateSettings(
1925+
textGenerationModelPatch(
1926+
resolveAppModelSelectionState(
1927+
{
1928+
...settings,
1929+
textGenerationModelSelection: createModelSelection(instanceId, model),
1930+
},
1931+
textGenerationProviders,
1932+
),
19181933
),
1919-
});
1934+
);
19201935
}}
19211936
/>
19221937
{textGenInstanceEntry ? (

0 commit comments

Comments
 (0)