File tree Expand file tree Collapse file tree
src/lib/components/chat/MessageInput Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323 const submitHandler = async () => {
2424 // Normalize Windows CRLF (\r\n) to LF (\n) for all string values
25+ // Build a new object to avoid mutating the reactive variableValues proxy
26+ const result = {};
2527 for (const key of Object .keys (variableValues )) {
2628 if (typeof variableValues [key ] === ' string' ) {
27- variableValues [key ] = variableValues [key ].replace (/ \r\n / g , ' \n ' );
29+ result [key ] = variableValues [key ].replace (/ \r\n / g , ' \n ' );
30+ } else {
31+ result [key ] = variableValues [key ];
2832 }
2933 }
30- onSave (variableValues );
34+ onSave (result );
3135 show = false ;
3236 };
3337
102106 <div class =" flex mt-0.5 mb-0.5 space-x-2" >
103107 <div class =" flex-1" >
104108 {#if variables [variable ]?.type === ' select' }
105- {@const options = variableAttributes ?.options ?? []}
106- {@const placeholder = variableAttributes ?.placeholder ?? ' ' }
107-
108109 <select
109110 class =" w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-hidden border border-gray-100/30 dark:border-gray-850/30"
110111 bind:value ={variableValues [variable ]}
111112 id ="input-variable- {idx }"
112113 >
113- {#if placeholder }
114+ {#if variables [ variable ]?. placeholder }
114115 <option value =" " disabled selected >
115- {placeholder }
116+ {variables [ variable ]. placeholder }
116117 </option >
117118 {/if }
118- {#each options as option }
119+ {#each variables [ variable ]?. options ?? [] as option }
119120 <option value ={option } selected ={option === variableValues [variable ]}>
120121 {option }
121122 </option >
You can’t perform that action at this time.
0 commit comments