From be35c8f658a0d38b3e838183b8220ee197f2a5ed Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Thu, 1 Oct 2026 00:07:50 -0400 Subject: [PATCH] fix: save list user valves in Chat Controls the way the valves dialog does (#31300) --- src/lib/components/chat/Controls/Valves.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Controls/Valves.svelte b/src/lib/components/chat/Controls/Valves.svelte index 13adbcc868..a431ad43e8 100644 --- a/src/lib/components/chat/Controls/Valves.svelte +++ b/src/lib/components/chat/Controls/Valves.svelte @@ -66,7 +66,11 @@ if (valvesSpec.properties[property]?.input?.type === 'multiselect') { continue; } - valves[property] = (valves[property] ?? []).join(','); + if (valves[property] != null) { + valves[property] = (Array.isArray(valves[property]) ? valves[property] : []).join(','); + } else { + valves[property] = null; + } } } } @@ -79,10 +83,14 @@ // Convert string to array for (const property in valvesSpec.properties) { if (valvesSpec.properties[property]?.type === 'array') { - if (valvesSpec.properties[property]?.input?.type === 'multiselect') { - continue; + if (typeof valves[property] === 'string') { + valves[property] = (valves[property] ?? '') + .split(',') + .map((v) => v.trim()) + .filter((v) => v.length > 0); + } else if (valves[property] == null) { + valves[property] = null; } - valves[property] = (valves[property] ?? '').split(',').map((v) => v.trim()); } }