@@ -122,12 +122,26 @@ export function SettingsPanel({ isOpen, onClose }: SettingsPanelProps) {
122122 type = "number"
123123 min = "1"
124124 max = "20"
125- value = { chatConfig . maxChunks || 5 }
126- onChange = { ( e ) =>
127- updateChatConfig ( {
128- maxChunks : Math . max ( 1 , Math . min ( 20 , parseInt ( e . target . value ) || 5 ) ) ,
129- } )
130- }
125+ value = { chatConfig . maxChunks ?? '' }
126+ onChange = { ( e ) => {
127+ const value = e . target . value ;
128+ if ( value === '' ) {
129+ updateChatConfig ( { maxChunks : undefined } ) ;
130+ } else {
131+ const num = parseInt ( value ) ;
132+ if ( ! isNaN ( num ) ) {
133+ updateChatConfig ( {
134+ maxChunks : Math . max ( 1 , Math . min ( 20 , num ) ) ,
135+ } ) ;
136+ }
137+ }
138+ } }
139+ onBlur = { ( e ) => {
140+ const value = e . target . value ;
141+ if ( value === '' || isNaN ( parseInt ( value ) ) ) {
142+ updateChatConfig ( { maxChunks : 5 } ) ;
143+ }
144+ } }
131145 />
132146 </ div >
133147
@@ -147,12 +161,26 @@ export function SettingsPanel({ isOpen, onClose }: SettingsPanelProps) {
147161 min = "0"
148162 max = "2"
149163 step = "0.1"
150- value = { chatConfig . temperature || 0.7 }
151- onChange = { ( e ) =>
152- updateChatConfig ( {
153- temperature : Math . max ( 0 , Math . min ( 2 , parseFloat ( e . target . value ) || 0.7 ) ) ,
154- } )
155- }
164+ value = { chatConfig . temperature ?? '' }
165+ onChange = { ( e ) => {
166+ const value = e . target . value ;
167+ if ( value === '' ) {
168+ updateChatConfig ( { temperature : undefined } ) ;
169+ } else {
170+ const num = parseFloat ( value ) ;
171+ if ( ! isNaN ( num ) ) {
172+ updateChatConfig ( {
173+ temperature : Math . max ( 0 , Math . min ( 2 , num ) ) ,
174+ } ) ;
175+ }
176+ }
177+ } }
178+ onBlur = { ( e ) => {
179+ const value = e . target . value ;
180+ if ( value === '' || isNaN ( parseFloat ( value ) ) ) {
181+ updateChatConfig ( { temperature : 0.7 } ) ;
182+ }
183+ } }
156184 />
157185 </ div >
158186
@@ -171,12 +199,26 @@ export function SettingsPanel({ isOpen, onClose }: SettingsPanelProps) {
171199 type = "number"
172200 min = "1"
173201 max = "50"
174- value = { chatConfig . topK || 10 }
175- onChange = { ( e ) =>
176- updateChatConfig ( {
177- topK : Math . max ( 1 , Math . min ( 50 , parseInt ( e . target . value ) || 10 ) ) ,
178- } )
179- }
202+ value = { chatConfig . topK ?? '' }
203+ onChange = { ( e ) => {
204+ const value = e . target . value ;
205+ if ( value === '' ) {
206+ updateChatConfig ( { topK : undefined } ) ;
207+ } else {
208+ const num = parseInt ( value ) ;
209+ if ( ! isNaN ( num ) ) {
210+ updateChatConfig ( {
211+ topK : Math . max ( 1 , Math . min ( 50 , num ) ) ,
212+ } ) ;
213+ }
214+ }
215+ } }
216+ onBlur = { ( e ) => {
217+ const value = e . target . value ;
218+ if ( value === '' || isNaN ( parseInt ( value ) ) ) {
219+ updateChatConfig ( { topK : 10 } ) ;
220+ }
221+ } }
180222 />
181223 </ div >
182224 </ div >
0 commit comments