|
8 | 8 | type DesktopUpdateChannel, |
9 | 9 | IDLE_COMPACTION_MODES, |
10 | 10 | globalIdleCompaction, |
| 11 | + type ModelSelection, |
11 | 12 | ProviderDriverKind, |
12 | 13 | type ProviderInstanceId, |
13 | 14 | type SidebarProjectGroupingMode, |
@@ -893,6 +894,19 @@ export function GeneralSettingsPanel() { |
893 | 894 | instanceId === textGenInstanceId && model === textGenModel |
894 | 895 | ? "This is already the text generation model." |
895 | 896 | : 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 | + }; |
896 | 910 | const textGenerationFallbackInstanceEntry = textGenerationModelInstanceEntries.find( |
897 | 911 | (entry) => entry.instanceId === textGenerationFallbackSelection.instanceId, |
898 | 912 | ); |
@@ -1859,10 +1873,9 @@ export function GeneralSettingsPanel() { |
1859 | 1873 | <SettingResetButton |
1860 | 1874 | label="text generation model" |
1861 | 1875 | onClick={() => |
1862 | | - updateSettings({ |
1863 | | - textGenerationModelSelection: |
1864 | | - DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection, |
1865 | | - }) |
| 1876 | + updateSettings( |
| 1877 | + textGenerationModelPatch(DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection), |
| 1878 | + ) |
1866 | 1879 | } |
1867 | 1880 | /> |
1868 | 1881 | ) : null |
@@ -1908,15 +1921,17 @@ export function GeneralSettingsPanel() { |
1908 | 1921 | }); |
1909 | 1922 | return; |
1910 | 1923 | } |
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 | + ), |
1918 | 1933 | ), |
1919 | | - }); |
| 1934 | + ); |
1920 | 1935 | }} |
1921 | 1936 | /> |
1922 | 1937 | {textGenInstanceEntry ? ( |
|
0 commit comments