@@ -296,19 +296,34 @@ const ServiceItem = (props: ServiceItemProps) => {
296
296
/>
297
297
< TextItem
298
298
label = { intl . formatMessage ( { defaultMessage : 'Input token limit' } ) }
299
+ type = 'number'
299
300
value = { props . service . tokenLimit . toString ( ) }
300
- onChange = { ( e ) => props . onChange ( { ...props . service , tokenLimit : parseInt ( e . target . value , 10 ) } ) }
301
+ onChange = { ( e ) => {
302
+ const value = parseInt ( e . target . value , 10 ) ;
303
+ const tokenLimit = isNaN ( value ) ? 0 : value ;
304
+ props . onChange ( { ...props . service , tokenLimit} ) ;
305
+ } }
301
306
/>
302
307
< TextItem
303
308
label = { intl . formatMessage ( { defaultMessage : 'Output token limit' } ) }
309
+ type = 'number'
304
310
value = { props . service . outputTokenLimit ?. toString ( ) || getDefaultOutputTokenLimit ( ) }
305
- onChange = { ( e ) => props . onChange ( { ...props . service , outputTokenLimit : parseInt ( e . target . value , 10 ) } ) }
311
+ onChange = { ( e ) => {
312
+ const value = parseInt ( e . target . value , 10 ) ;
313
+ const outputTokenLimit = isNaN ( value ) ? 0 : value ;
314
+ props . onChange ( { ...props . service , outputTokenLimit} ) ;
315
+ } }
306
316
/>
307
317
{ isOpenAIType && (
308
318
< TextItem
309
319
label = { intl . formatMessage ( { defaultMessage : 'Streaming Timeout Seconds' } ) }
320
+ type = 'number'
310
321
value = { props . service . streamingTimeoutSeconds ?. toString ( ) || '0' }
311
- onChange = { ( e ) => props . onChange ( { ...props . service , streamingTimeoutSeconds : parseInt ( e . target . value , 10 ) } ) }
322
+ onChange = { ( e ) => {
323
+ const value = parseInt ( e . target . value , 10 ) ;
324
+ const streamingTimeoutSeconds = isNaN ( value ) ? 0 : value ;
325
+ props . onChange ( { ...props . service , streamingTimeoutSeconds} ) ;
326
+ } }
312
327
/>
313
328
) }
314
329
</ >
0 commit comments