mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
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.
26 lines
820 B
TypeScript
26 lines
820 B
TypeScript
import type { AISettings } from '@/contexts/AISettingsContext';
|
|
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. */
|
|
export const OPENCODE_DEFAULT_SETTINGS: AISettings = {
|
|
providers: [
|
|
{
|
|
id: opencodePreset.id,
|
|
name: opencodePreset.name,
|
|
baseURL: opencodePreset.baseURL,
|
|
proxy: opencodePreset.proxy,
|
|
},
|
|
],
|
|
recentlyUsedModels: ['opencode/big-pickle'],
|
|
mcpServers: {},
|
|
};
|