Fix default settings overriding user's recently used models

Separate EMPTY_AI_SETTINGS (for initial state and error fallback) from
OPENCODE_DEFAULT_SETTINGS (for genuinely new users only). Previously,
readAISettings returned OPENCODE_DEFAULT_SETTINGS on any error, which
could overwrite an existing user's recentlyUsedModels with
['opencode/big-pickle']. Now the error path returns empty settings, and
OPENCODE defaults are only applied when no providers are configured.
This commit is contained in:
Alex Gleason committed 2026-04-04 02:13:35 -05:00
1 parent 0a2cbf4bca
commit 2736f71687
5 files changed
+58 -15

No files matched your search

+8 -1
View File
@@ -3,7 +3,14 @@ import { AI_PROVIDER_PRESETS } from '@/lib/aiProviderPresets';
const opencodePreset = AI_PROVIDER_PRESETS.find((p) => p.id === 'opencode')!;
/** Default AI settings with OpenCode Zen pre-configured and big-pickle selected. */
/** 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. */
export const OPENCODE_DEFAULT_SETTINGS: AISettings = {
providers: [
{