diff --git a/src/lib/components/chat/MessageInput/InputVariablesModal.svelte b/src/lib/components/chat/MessageInput/InputVariablesModal.svelte index e75e2d18c1..e812312336 100644 --- a/src/lib/components/chat/MessageInput/InputVariablesModal.svelte +++ b/src/lib/components/chat/MessageInput/InputVariablesModal.svelte @@ -22,12 +22,16 @@ const submitHandler = async () => { // Normalize Windows CRLF (\r\n) to LF (\n) for all string values + // Build a new object to avoid mutating the reactive variableValues proxy + const result = {}; for (const key of Object.keys(variableValues)) { if (typeof variableValues[key] === 'string') { - variableValues[key] = variableValues[key].replace(/\r\n/g, '\n'); + result[key] = variableValues[key].replace(/\r\n/g, '\n'); + } else { + result[key] = variableValues[key]; } } - onSave(variableValues); + onSave(result); show = false; }; @@ -102,20 +106,17 @@