@@ -219,7 +219,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
219
219
} }
220
220
>
221
221
< TableCell align = "right" >
222
- < Radio checked = { tempSelectedModelId == undefined } name = "radio-buttons" inputProps = { { 'aria-label' : 'Select this model' } } />
222
+ < Radio size = "small" checked = { tempSelectedModelId == undefined } name = "radio-buttons" slotProps = { { input : { 'aria-label' : 'Select this model' } } } />
223
223
</ TableCell >
224
224
< TableCell align = "left" >
225
225
< Autocomplete
@@ -244,30 +244,40 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
244
244
< TextField
245
245
{ ...params }
246
246
placeholder = "provider"
247
- InputProps = { {
248
- ...params . InputProps ,
249
- style : { fontSize : "0.875rem" }
247
+ slotProps = { {
248
+ input : {
249
+ ...params . InputProps ,
250
+ style : { fontSize : "0.875rem" }
251
+ }
250
252
} }
251
253
size = "small"
252
254
onChange = { ( event : any ) => setNewEndpoint ( event . target . value ) }
253
255
/>
254
256
) }
255
- ListboxProps = { {
256
- style : { padding : 0 }
257
+ slotProps = { {
258
+ listbox : {
259
+ style : { padding : 0 }
260
+ } ,
261
+ } }
262
+ slots = { {
263
+ paper : ( props ) => {
264
+ return < Paper { ...props } >
265
+ < Typography sx = { { p : 1 , color : 'gray' , fontStyle : 'italic' , fontSize : '0.75rem' } } >
266
+ examples
267
+ </ Typography >
268
+ { props . children }
269
+ </ Paper >
270
+ }
257
271
} }
258
- PaperComponent = { ( { children } ) => (
259
- < Paper >
260
- < Typography sx = { { p : 1 , color : 'gray' , fontStyle : 'italic' , fontSize : '0.75rem' } } >
261
- examples
262
- </ Typography >
263
- { children }
264
- </ Paper >
265
- ) }
266
272
/>
267
273
</ TableCell >
268
274
< TableCell align = "left" >
269
275
< TextField fullWidth size = "small" type = { showKeys ? "text" : "password" }
270
- InputProps = { { style : { fontSize : "0.875rem" } } }
276
+ slotProps = { {
277
+ input : {
278
+ style : { fontSize : "0.875rem" }
279
+ }
280
+ } }
271
281
placeholder = 'leave blank if using keyless access'
272
282
value = { newApiKey }
273
283
onChange = { ( event : any ) => { setNewApiKey ( event . target . value ) ; } }
@@ -290,51 +300,63 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
290
300
error = { newEndpoint != "" && ! newModel }
291
301
{ ...params }
292
302
placeholder = "model name"
293
- InputProps = { {
294
- ...params . InputProps ,
295
- style : { fontSize : "0.875rem" } ,
296
- endAdornment : (
297
- < >
298
- { isLoadingModelOptions ? < CircularProgress color = "primary" size = { 20 } /> : null }
299
- { params . InputProps . endAdornment }
300
- </ >
301
- ) ,
302
- } }
303
- inputProps = { {
304
- ...params . inputProps ,
305
- 'aria-label' : 'Select or enter a model' ,
303
+ slotProps = { {
304
+ input : {
305
+ ...params . InputProps ,
306
+ style : { fontSize : "0.875rem" } ,
307
+ endAdornment : (
308
+ < >
309
+ { isLoadingModelOptions ? < CircularProgress color = "primary" size = { 20 } /> : null }
310
+ { params . InputProps . endAdornment }
311
+ </ >
312
+ ) ,
313
+ } ,
314
+ htmlInput : {
315
+ ...params . inputProps ,
316
+ 'aria-label' : 'Select or enter a model' ,
317
+ }
306
318
} }
307
319
size = "small"
308
320
onChange = { ( event : any ) => { setNewModel ( event . target . value ) ; } }
309
321
/>
310
322
) }
311
- ListboxProps = { {
312
- style : { padding : 0 }
323
+ slotProps = { {
324
+ listbox : {
325
+ style : { padding : 0 }
326
+ } ,
313
327
} }
314
- PaperComponent = { ( { children } ) => (
315
- < Paper >
316
- { ! isLoadingModelOptions && (
328
+ slots = { {
329
+ paper : ( props ) => {
330
+ return < Paper { ... props } >
317
331
< Typography sx = { { p : 1 , color : 'gray' , fontStyle : 'italic' , fontSize : 'small' } } >
318
332
examples
319
333
</ Typography >
320
- ) }
321
- { children }
322
- </ Paper >
323
- ) }
334
+ { props . children }
335
+ </ Paper >
336
+ }
337
+ } }
324
338
/>
325
339
</ TableCell >
326
340
< TableCell align = "right" >
327
341
< TextField size = "small" type = "text" fullWidth
328
342
placeholder = "api_base"
329
- InputProps = { { style : { fontSize : "0.875rem" } } }
343
+ slotProps = { {
344
+ input : {
345
+ style : { fontSize : "0.875rem" }
346
+ }
347
+ } }
330
348
value = { newApiBase }
331
349
onChange = { ( event : any ) => { setNewApiBase ( event . target . value ) ; } }
332
350
autoComplete = 'off'
333
351
/>
334
352
</ TableCell >
335
353
< TableCell align = "right" >
336
354
< TextField size = "small" type = "text" fullWidth
337
- InputProps = { { style : { fontSize : "0.875rem" } } }
355
+ slotProps = { {
356
+ input : {
357
+ style : { fontSize : "0.875rem" }
358
+ }
359
+ } }
338
360
value = { newApiVersion } onChange = { ( event : any ) => { setNewApiVersion ( event . target . value ) ; } }
339
361
autoComplete = 'off'
340
362
placeholder = "api_version"
@@ -348,8 +370,6 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
348
370
onClick = { ( event ) => {
349
371
event . stopPropagation ( )
350
372
351
- console . log ( "checkpont 1" )
352
-
353
373
let endpoint = newEndpoint ;
354
374
355
375
let id = `${ endpoint } -${ newModel } -${ newApiKey } -${ newApiBase } -${ newApiVersion } ` ;
@@ -397,7 +417,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
397
417
< TableCell align = "right" > </ TableCell >
398
418
< TableCell sx = { { fontWeight : 'bold' , width : '120px' } } > provider</ TableCell >
399
419
< TableCell sx = { { fontWeight : 'bold' , width : '240px' } } > api_key</ TableCell >
400
- < TableCell sx = { { fontWeight : 'bold' , width : '120px ' } } align = "left" > model</ TableCell >
420
+ < TableCell sx = { { fontWeight : 'bold' , width : '160px ' } } align = "left" > model</ TableCell >
401
421
< TableCell sx = { { fontWeight : 'bold' , width : '240px' } } align = "left" > api_base</ TableCell >
402
422
< TableCell sx = { { fontWeight : 'bold' , width : '120px' } } align = "left" > api_version</ TableCell >
403
423
< TableCell sx = { { fontWeight : 'bold' } } align = "right" > Status</ TableCell >
@@ -414,35 +434,33 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
414
434
415
435
let message = "the model is ready to use" ;
416
436
if ( status == "unknown" ) {
417
- message = "Click the status icon to test again before applying ." ;
437
+ message = "click the status icon to test the model availability ." ;
418
438
} else if ( status == "error" ) {
419
439
const rawMessage = testedModels . find ( t => t . id == model . id ) ?. message || "Unknown error" ;
420
440
message = decodeHtmlEntities ( rawMessage ) ;
421
441
}
422
442
423
- const borderStyle = [ 'error' , 'unknown' ] . includes ( status ) ? '1px dashed text.secondary ' : undefined ;
443
+ const borderStyle = [ 'error' , 'unknown' ] . includes ( status ) ? '1px dashed lightgray ' : undefined ;
424
444
const noBorderStyle = [ 'error' , 'unknown' ] . includes ( status ) ? 'none' : undefined ;
425
445
426
- console . log ( message )
427
-
428
446
return (
429
- < >
447
+ < React . Fragment key = { ` ${ model . id } ` } >
430
448
< TableRow
431
449
selected = { isItemSelected }
432
450
key = { `${ model . id } ` }
433
451
onClick = { ( ) => { setTempSelectedModelId ( model . id ) } }
434
- sx = { { cursor : 'pointer' } }
452
+ sx = { { cursor : 'pointer' , '& .MuiTableCell-root' : { p : 0.5 , fontSize : 14 } } }
435
453
>
436
- < TableCell align = "right" sx = { { borderBottom : noBorderStyle } } >
437
- < Radio checked = { isItemSelected } name = "radio-buttons" inputProps = { { 'aria-label' : 'Select this model' } } />
454
+ < TableCell align = "right" sx = { { borderBottom : noBorderStyle , } } >
455
+ < Radio size = "small" checked = { isItemSelected } name = "radio-buttons" slotProps = { { input : { 'aria-label' : 'Select this model' } } } />
438
456
</ TableCell >
439
- < TableCell align = "left" sx = { { borderBottom : noBorderStyle } } >
457
+ < TableCell align = "left" sx = { { borderBottom : noBorderStyle , p : 0 } } >
440
458
{ model . endpoint }
441
459
</ TableCell >
442
460
< TableCell component = "th" scope = "row" sx = { { borderBottom : borderStyle } } >
443
461
{ model . api_key ? ( showKeys ?
444
- < Typography
445
- sx = { {
462
+ < Typography
463
+ sx = { {
446
464
maxWidth : '240px' ,
447
465
wordBreak : 'break-all' ,
448
466
whiteSpace : 'normal'
@@ -465,8 +483,10 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
465
483
{ model . api_version }
466
484
</ TableCell >
467
485
< TableCell sx = { { fontWeight : 'bold' , borderBottom : borderStyle } } align = "right" >
468
- < Tooltip title = { message } >
486
+ < Tooltip title = {
487
+ status == 'ok' ? message : 'test model availability' } >
469
488
< IconButton
489
+ size = "small"
470
490
onClick = { ( ) => { testModel ( model ) } }
471
491
>
472
492
{ statusIcon }
@@ -476,6 +496,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
476
496
< TableCell sx = { { borderBottom : borderStyle } } align = "right" >
477
497
< Tooltip title = "remove model" >
478
498
< IconButton
499
+ size = "small"
479
500
onClick = { ( ) => {
480
501
dispatch ( dfActions . removeModel ( model . id ) ) ;
481
502
if ( ( tempSelectedModelId )
@@ -506,14 +527,13 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
506
527
>
507
528
< TableCell colSpan = { 2 } align = "right" > </ TableCell >
508
529
< TableCell colSpan = { 6 } >
509
- < Typography variant = "caption" color = "#c82c2c" >
530
+ < Typography variant = "caption" color = "#c82c2c" sx = { { fontSize : "0.625rem" } } >
510
531
{ message }
511
-
512
532
</ Typography >
513
533
</ TableCell >
514
534
</ TableRow >
515
535
) }
516
- </ >
536
+ </ React . Fragment >
517
537
)
518
538
} ) }
519
539
{ newModelEntry }
0 commit comments