Skip to content

Commit d6e9c16

Browse files
authored
FEAT: [UI] display the model_ability parameter. (xorbitsai#3308)
1 parent fcc3fee commit d6e9c16

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

xinference/web/ui/src/scenes/launch_model/modelCard.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,34 @@ const ModelCard = ({
880880
return <RocketLaunchOutlined sx={{ fontSize: 26 }} />
881881
}
882882

883+
const showAbilityParameter = () => {
884+
if (!modelData.model_ability) return
885+
if (Array.isArray(modelData.model_ability)) {
886+
return modelData.model_ability.map((v) => {
887+
return (
888+
<Chip
889+
key={v}
890+
label={v}
891+
size="small"
892+
onClick={(e) => {
893+
e.stopPropagation()
894+
}}
895+
/>
896+
)
897+
})
898+
} else {
899+
return (
900+
<Chip
901+
label={modelData.model_ability}
902+
size="small"
903+
onClick={(e) => {
904+
e.stopPropagation()
905+
}}
906+
/>
907+
)
908+
}
909+
}
910+
883911
// Set two different states based on mouse hover
884912
return (
885913
<>
@@ -979,6 +1007,7 @@ const ModelCard = ({
9791007
flexWrap="wrap"
9801008
sx={{ marginLeft: 1 }}
9811009
>
1010+
{showAbilityParameter()}
9821011
{modelData.model_lang &&
9831012
(() => {
9841013
return modelData.model_lang.map((v) => {
@@ -1158,6 +1187,7 @@ const ModelCard = ({
11581187
flexWrap="wrap"
11591188
sx={{ marginLeft: 1 }}
11601189
>
1190+
{showAbilityParameter()}
11611191
{(() => {
11621192
if (modelData.language) {
11631193
return normalizeLanguage(modelData.language).map((v) => {
@@ -1186,20 +1216,6 @@ const ModelCard = ({
11861216
)
11871217
}
11881218
})()}
1189-
{(() => {
1190-
if (modelType === 'audio' && modelData.model_ability) {
1191-
return (
1192-
<Chip
1193-
label={modelData.model_ability}
1194-
variant="outlined"
1195-
size="small"
1196-
onClick={(e) => {
1197-
e.stopPropagation()
1198-
}}
1199-
/>
1200-
)
1201-
}
1202-
})()}
12031219
{(() => {
12041220
if (modelData.cache_status) {
12051221
return (

0 commit comments

Comments
 (0)