feat: add default variant support in settings and UI components

This commit is contained in:
Bohdan Triapitsyn
2026-01-08 16:08:51 +02:00
parent 8e777a94c2
commit ab731fdc79
9 changed files with 330 additions and 95 deletions
+9
View File
@@ -80,6 +80,15 @@ const persistSettings = async (changes: Record<string, unknown>, ctx?: BridgeCon
const current = readSettings(ctx);
const restChanges = { ...(changes || {}) };
delete restChanges.lastDirectory;
// Normalize empty-string clears to key removal (match web/desktop behavior)
for (const key of ['defaultModel', 'defaultVariant', 'defaultAgent']) {
const value = restChanges[key];
if (typeof value === 'string' && value.trim().length === 0) {
delete restChanges[key];
}
}
const merged = { ...current, ...restChanges, lastDirectory: current.lastDirectory };
await ctx?.context?.globalState.update(SETTINGS_KEY, merged);
return merged;