@@ -242,7 +242,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
242
242
const assignedModel = assignedModelId ? models . find ( m => m . id === assignedModelId ) : undefined ;
243
243
244
244
return (
245
- < Box
245
+ < Paper
246
246
key = { slotType }
247
247
sx = { {
248
248
flex : '1 1 250px' ,
@@ -254,8 +254,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
254
254
} }
255
255
>
256
256
< Typography variant = "body2" sx = { { fontWeight : 'bold' , mb : 1 } } >
257
- { slotType } tasks < Typography variant = "caption" sx = { { fontSize : '0.75rem' , color : 'text.secondary' } } >
258
- { slotType == 'generation' ? '' : '(small faster model recommended)' } </ Typography >
257
+ { slotType } tasks
259
258
</ Typography >
260
259
261
260
< FormControl fullWidth size = "small" >
@@ -270,17 +269,36 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
270
269
sx = { { fontSize : '0.875rem' } }
271
270
renderValue = { ( selected ) => {
272
271
if ( ! selected ) {
273
- return < Typography sx = { { color : 'text.secondary' , fontSize : '0.875rem' } } > No model assigned</ Typography > ;
272
+ return < Box sx = { { display : 'flex' , alignItems : 'center' , width : '100%' } } >
273
+ < Box sx = { { flex : 1 } } >
274
+ < Typography variant = "body2" sx = { { fontSize : '0.875rem' } } >
275
+ No model assigned
276
+ </ Typography >
277
+ </ Box >
278
+ < ErrorOutlineIcon sx = { { color : 'error.main' , ml : 1 } } fontSize = "small" />
279
+ </ Box > ;
274
280
}
275
281
const model = models . find ( m => m . id === selected ) ;
276
- return model ? `${ model . endpoint } /${ model . model } ` : 'Unknown model' ;
282
+ return model ? < Box sx = { { display : 'flex' , alignItems : 'center' , width : '100%' } } >
283
+ < Box sx = { { flex : 1 } } >
284
+ < Typography variant = "body2" sx = { { fontSize : '0.875rem' } } >
285
+ { model . endpoint } /{ model . model }
286
+ { model . api_base && (
287
+ < Typography variant = "caption" sx = { { ml : 0.5 , color : 'text.secondary' , fontSize : '0.75rem' } } >
288
+ ({ model . api_base } )
289
+ </ Typography >
290
+ ) }
291
+ </ Typography >
292
+ </ Box >
293
+ < CheckCircleOutlineIcon sx = { { color : 'success.main' , ml : 1 } } fontSize = "small" />
294
+ </ Box > : 'Unknown model' ;
277
295
} }
278
296
>
279
297
< MenuItem value = "" >
280
298
< Typography sx = { { color : 'text.secondary' , fontSize : '0.875rem' } } > No assignment</ Typography >
281
299
</ MenuItem >
282
- { models . filter ( m => getStatus ( m . id ) === 'ok' ) . map ( ( model ) => (
283
- < MenuItem key = { model . id } value = { model . id } >
300
+ { models . map ( ( model ) => (
301
+ < MenuItem key = { model . id } value = { model . id } disabled = { getStatus ( model . id ) !== 'ok' } >
284
302
< Box sx = { { display : 'flex' , alignItems : 'center' , width : '100%' } } >
285
303
< Box sx = { { flex : 1 } } >
286
304
< Typography variant = "body2" sx = { { fontSize : '0.875rem' } } >
@@ -292,28 +310,21 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
292
310
</ Typography >
293
311
) }
294
312
</ Box >
295
- < CheckCircleOutlineIcon sx = { { color : 'success.main' , ml : 1 } } fontSize = "small" />
313
+ { getStatus ( model . id ) === 'ok' ? < CheckCircleOutlineIcon sx = { { color : 'success.main' , ml : 1 } } fontSize = "small" />
314
+ : getStatus ( model . id ) === 'error' ? < ErrorOutlineIcon sx = { { color : 'error.main' , ml : 1 } } fontSize = "small" />
315
+ : < HelpOutlineIcon sx = { { color : 'warning.main' , ml : 1 } } fontSize = "small" /> }
296
316
</ Box >
297
317
</ MenuItem >
298
318
) ) }
299
319
</ Select >
300
320
</ FormControl >
301
-
302
- { assignedModel && (
303
- < Typography variant = "caption" sx = { {
304
- display : 'block' ,
305
- color : 'text.secondary' ,
306
- mt : 0.5 ,
307
- fontSize : '0.75rem' ,
308
- fontStyle : 'italic'
309
- } } >
310
- { assignedModel . endpoint } /{ assignedModel . model } { assignedModel . api_base && ` (${ assignedModel . api_base } )` }
311
- </ Typography >
312
- ) }
313
- </ Box >
321
+ </ Paper >
314
322
) ;
315
323
} ) }
316
324
</ Box >
325
+ < Typography variant = "caption" sx = { { fontSize : '0.75rem' , color : 'text.secondary' } } >
326
+ < strong > Note:</ strong > Models with strong code generation capabilities is recommended for generation tasks.
327
+ </ Typography >
317
328
</ Box >
318
329
) ;
319
330
} ;
@@ -499,7 +510,11 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
499
510
updateModelStatus ( model , status , data [ "message" ] || "" ) ;
500
511
// Only assign to slot if test is successful
501
512
if ( status === 'ok' ) {
502
- updateTempSlot ( 'generation' , id ) ;
513
+ for ( let slotType of dfSelectors . getAllSlotTypes ( ) ) {
514
+ if ( ! tempModelSlots [ slotType ] ) {
515
+ updateTempSlot ( slotType , id ) ;
516
+ }
517
+ }
503
518
}
504
519
} ) . catch ( ( error ) => {
505
520
updateModelStatus ( model , 'error' , error . message )
@@ -567,6 +582,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
567
582
568
583
const borderStyle = [ 'error' ] . includes ( status ) ? '1px dashed lightgray' : undefined ;
569
584
const noBorderStyle = [ 'error' ] . includes ( status ) ? 'none' : undefined ;
585
+
586
+ // Check if model is assigned to any slot
587
+ const isAssignedToAnySlot = dfSelectors . getAllSlotTypes ( ) . some ( slotType => isModelAssignedToSlot ( model . id , slotType ) ) ;
570
588
571
589
return (
572
590
< React . Fragment key = { `${ model . id } ` } >
@@ -575,7 +593,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
575
593
sx = { {
576
594
'& .MuiTableCell-root' : { fontSize : '0.75rem' } ,
577
595
'&:hover' : { backgroundColor : '#f8f9fa' } ,
578
- backgroundColor : status == 'ok' ? alpha ( theme . palette . success . main , 0.07 ) : '#fff'
596
+ backgroundColor : isAssignedToAnySlot ? alpha ( theme . palette . success . main , 0.07 ) : '#fff'
579
597
} }
580
598
>
581
599
< TableCell align = "left" sx = { { borderBottom : noBorderStyle } } >
@@ -716,9 +734,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
716
734
< strong > Configuration:</ strong > Based on LiteLLM. < a href = "https://docs.litellm.ai/docs/" target = "_blank" rel = "noopener noreferrer" > See supported providers</ a > .
717
735
Use 'openai' provider for OpenAI-compatible APIs.
718
736
</ Typography >
719
- < Typography variant = "caption" sx = { { fontSize : '0.75rem' , color : 'warning.main' } } >
720
- < strong > Note:</ strong > Models with limited code generation capabilities may fail frequently.
721
- </ Typography >
737
+
722
738
</ TableCell >
723
739
</ TableRow >
724
740
</ TableBody >
0 commit comments