fix(x): chat model-call field opens as 'Same as above' unless it differs

A chat override equal to the global limit is behaviorally identical to
no override, so persist it as absent and collapse it on load. Stepping
the empty chat field (which lands on the global value) no longer pins a
redundant override that makes the field open with a number forever.
This commit is contained in:
Gagan 2026-07-21 15:33:35 +05:30
parent dd04738015
commit af19cad43b

View file

@ -2732,7 +2732,13 @@ function AdvancedSettings({ dialogOpen }: { dialogOpen: boolean }) {
.then((settings) => {
if (cancelled) return
setGlobalLimit(String(settings.maxModelCalls))
setChatLimit(settings.chatMaxModelCalls !== undefined ? String(settings.chatMaxModelCalls) : "")
// A chat override equal to the global limit is no override — show
// "Same as above" (legacy files; saves already collapse this).
setChatLimit(
settings.chatMaxModelCalls !== undefined && settings.chatMaxModelCalls !== settings.maxModelCalls
? String(settings.chatMaxModelCalls)
: ""
)
setLoaded(true)
})
.catch(() => {
@ -2758,6 +2764,9 @@ function AdvancedSettings({ dialogOpen }: { dialogOpen: boolean }) {
}
chat = parsed
}
// An override equal to the global limit is meaningless — persist it as
// "use the global limit" so the field reopens as "Same as above".
if (chat === global) chat = undefined
try {
await window.ipc.invoke("turnLimits:setSettings", {
maxModelCalls: global,