fix: switching an optional valve to Custom in the chat controls shows an error (#34478)

* fix: switching an optional valve to Custom in the chat controls shows an error

Switching an optional valve, such as an optional on/off setting, from Default to Custom in the Valves section of the chat controls saved the still empty box right away, and the server refused it with "Error updating function user valves". Emptying the box later failed the same way. Switching to Custom now saves once something is entered, and an emptied optional on/off or number valve goes back to its default; optional text valves still save an empty text.

Fixes #34475

* Drop a comment that restates its condition

* Name schema entries the way the schema helpers do
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-17 13:59:54 +09:00
1 parent 5ddd419539
commit 958edefcac
2 files changed
+8 -1

No files matched your search

@@ -94,6 +94,11 @@
} else if (valves[property] == null) {
valves[property] = null;
}
} else if (valves[property] === '') {
const types = (valvesSpec.properties[property]?.anyOf ?? []).map((inner) => inner.type);
if (types.includes('null') && !types.includes('string')) {
valves[property] = null;
}
}
}
+3 -1
View File
@@ -55,7 +55,9 @@
valves[property] = null;
}
dispatch('change');
if (valves[property] !== '') {
dispatch('change');
}
}}
>
{#if (valves[property] ?? null) === null}