f2d28a1cca
Each agent CLI declares its selectable models (and reasoning effort, for Codex) on the daemon side; the frontend renders a model dropdown in the avatar menu and the Settings dialog scoped to the currently picked CLI, persists the choice per-agent in the AppConfig, and threads it through /api/chat to the spawn argv. "Default" leaves the flag off so the CLI's own config wins.
31 lines
761 B
TypeScript
31 lines
761 B
TypeScript
import type { AppConfig } from '../types';
|
|
|
|
const STORAGE_KEY = 'open-design:config';
|
|
|
|
export const DEFAULT_CONFIG: AppConfig = {
|
|
mode: 'daemon',
|
|
apiKey: '',
|
|
baseUrl: 'https://api.anthropic.com',
|
|
model: 'claude-sonnet-4-5',
|
|
agentId: null,
|
|
skillId: null,
|
|
designSystemId: null,
|
|
onboardingCompleted: false,
|
|
agentModels: {},
|
|
};
|
|
|
|
export function loadConfig(): AppConfig {
|
|
try {
|
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
if (!raw) return { ...DEFAULT_CONFIG };
|
|
const parsed = JSON.parse(raw) as Partial<AppConfig>;
|
|
return { ...DEFAULT_CONFIG, ...parsed };
|
|
} catch {
|
|
return { ...DEFAULT_CONFIG };
|
|
}
|
|
}
|
|
|
|
export function saveConfig(config: AppConfig): void {
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
|
|
}
|