fix(agent): preserve unknown thinking_level in picker label

Stale persisted values (model swap, CLI catalog shrink) used to render
as 'Default' even though the backend would still ship the orphaned
token. Fall back to the raw value when no entry matches so the user
sees what's actually saved and can clear it.

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
Jiang Bohan
2026-05-20 13:34:49 +08:00
parent 688ebe1c9f
commit 3452fae3f9

View File

@@ -44,9 +44,13 @@ export function ThinkingPicker({
const [open, setOpen] = useState(false);
const selected = value ? levels.find((l) => l.value === value) : undefined;
// Unknown-but-set value (model swap that dropped the option, CLI upgrade
// that trimmed the catalog): show the raw token so the user can see what
// is actually persisted and clear it, rather than silently labelling it
// "Default" when the backend would still send the stale value.
const triggerLabel = selected
? selected.label
: t(($) => $.pickers.thinking_default);
: value || t(($) => $.pickers.thinking_default);
const triggerTitle = t(($) => $.pickers.thinking_tooltip, {
value: triggerLabel,
});