fix(ui): correct context pruning default toggle state

Backend enables pruning by default (only skips when mode="off"), but
UI showed toggle OFF when no config was saved (null). Also fixed global
config dropdown defaulting to "off" instead of "auto".
This commit is contained in:
viettranx committed 2026-03-29 13:00:19 +07:00
1 parent c5cd1ad412
commit d803539f1c
2 files changed
+2 -2

No files matched your search

@@ -52,7 +52,7 @@ export function AgentAdvancedDialog({ open, onOpenChange, agent, onUpdate }: Age
} as ChatGPTOAuthRoutingConfig,
wsSharing: (otherObj.workspace_sharing ?? {}) as WorkspaceSharingConfig,
comp: a.compaction_config ?? {},
pruneEnabled: a.context_pruning != null,
pruneEnabled: a.context_pruning?.mode !== "off",
prune: a.context_pruning ?? {},
sbEnabled: a.sandbox_config != null,
sb: a.sandbox_config ?? {},
@@ -207,7 +207,7 @@ export function AiDefaultsSection({ data, onSave, saving }: Props) {
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div className="grid gap-1.5">
<Label>{t("agents.pruning.mode")}</Label>
<Select value={pruning.mode ?? "off"} onValueChange={(v) => updateNested("contextPruning", { mode: v })}>
<Select value={pruning.mode ?? "auto"} onValueChange={(v) => updateNested("contextPruning", { mode: v })}>
<SelectTrigger><SelectValue /></SelectTrigger>
<SelectContent>
<SelectItem value="off">Off</SelectItem>