Revert "Fix default settings overriding user's recently used models"

This reverts commit 2736f71687.
This commit is contained in:
Alex Gleason committed 2026-04-29 13:58:02 -05:00
1 parent 7e93367b5f
commit 10edacbccb
5 files changed
+15 -58

No files matched your search

+5 -5
View File
@@ -7,7 +7,7 @@ import {
readDeploySettings,
writeDeploySettings
} from './configUtils';
import { EMPTY_AI_SETTINGS } from './opencode-defaults';
import { OPENCODE_DEFAULT_SETTINGS } from './opencode-defaults';
import type { JSRuntimeFS } from './JSRuntime';
import type { AISettings } from '@/contexts/AISettingsContext';
import type { GitSettings } from '@/contexts/GitSettingsContext';
@@ -90,22 +90,22 @@ describe('configUtils', () => {
});
});
it('should return empty settings if file does not exist and no localStorage data', async () => {
it('should return default settings with OpenCode Zen if file does not exist and no localStorage data', async () => {
vi.mocked(mockFS.readFile).mockRejectedValue(new Error('File not found'));
mockLocalStorage.getItem.mockReturnValue(null);
const result = await readAISettings(mockFS);
expect(result).toEqual(EMPTY_AI_SETTINGS);
expect(result).toEqual(OPENCODE_DEFAULT_SETTINGS);
});
it('should return empty settings if JSON is invalid and no localStorage data', async () => {
it('should return default settings with OpenCode Zen if JSON is invalid and no localStorage data', async () => {
vi.mocked(mockFS.readFile).mockResolvedValue('invalid json');
mockLocalStorage.getItem.mockReturnValue(null);
const result = await readAISettings(mockFS);
expect(result).toEqual(EMPTY_AI_SETTINGS);
expect(result).toEqual(OPENCODE_DEFAULT_SETTINGS);
});
});
+2 -2
View File
@@ -1,7 +1,7 @@
import z from 'zod';
import { filteredArray } from '@/lib/schema';
import { AI_PROVIDER_PRESETS } from '@/lib/aiProviderPresets';
import { EMPTY_AI_SETTINGS } from '@/lib/opencode-defaults';
import { OPENCODE_DEFAULT_SETTINGS } from '@/lib/opencode-defaults';
import type { JSRuntimeFS } from '@/lib/JSRuntime';
import type { AISettings, MCPServer } from '@/contexts/AISettingsContext';
import type { GitSettings, GitCredential } from '@/contexts/GitSettingsContext';
@@ -205,7 +205,7 @@ export async function readAISettings(fs: JSRuntimeFS, configPath = '/config'): P
if (error instanceof z.ZodError) {
console.error('AI settings parsing error:', error.issues);
}
return EMPTY_AI_SETTINGS;
return OPENCODE_DEFAULT_SETTINGS;
}
}
+1 -8
View File
@@ -3,14 +3,7 @@ import { AI_PROVIDER_PRESETS } from '@/lib/aiProviderPresets';
const opencodePreset = AI_PROVIDER_PRESETS.find((p) => p.id === 'opencode')!;
/** Empty AI settings used as initial state and error fallback. Won't overwrite user data. */
export const EMPTY_AI_SETTINGS: AISettings = {
providers: [],
recentlyUsedModels: [],
mcpServers: {},
};
/** Default AI settings with OpenCode Zen pre-configured and big-pickle selected. Only for genuinely new users. */
/** Default AI settings with OpenCode Zen pre-configured and big-pickle selected. */
export const OPENCODE_DEFAULT_SETTINGS: AISettings = {
providers: [
{