fix: stt languages sorting

This commit is contained in:
jialin
2026-02-06 17:33:06 +08:00
parent 18ffeb82a2
commit 1bd31d2936
3 changed files with 19 additions and 23 deletions
+8 -18
View File
@@ -30,8 +30,6 @@ const DatasetForm: React.FC = () => {
}
};
const labelRender = (label: string) => {};
// Initialize profile when open form
const initProfile = (
value: string,
@@ -52,23 +50,15 @@ const DatasetForm: React.FC = () => {
};
useEffect(() => {
if (open) {
if (open && action === PageAction.CREATE) {
const init = async () => {
if (
profilesOptions &&
profilesOptions.length > 0 &&
action === PageAction.CREATE
) {
const throughputProfile = profilesOptions.find(
(item) => item.value === ProfileValueMap.ThroughputMedium
);
if (throughputProfile) {
initProfile(
throughputProfile.value,
throughputProfile,
datasetList
);
}
if (!profilesOptions || profilesOptions.length === 0) return;
const throughputProfile = profilesOptions.find(
(item) => item.value === ProfileValueMap.ThroughputMedium
);
if (throughputProfile) {
initProfile(throughputProfile.value, throughputProfile, datasetList);
}
};
init();
+10 -4
View File
@@ -282,10 +282,16 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
const languages = selected?.meta?.languages || [];
let currentLanguage = [...defaultLanguages];
if (languages.length > 0) {
currentLanguage = allLanguages.filter(
(lang) =>
languages.includes(lang.value) || languages.includes(lang.label)
);
// sort languages based on the order in the model meta
currentLanguage = [];
languages.forEach((langCode: string) => {
const langItem = allLanguages.find((item) => item.value === langCode);
if (langItem) {
currentLanguage.push(langItem);
}
});
const newConfig = paramsConfig.map((item) => {
const oItem = _.cloneDeep(item);
if (item.name === 'language') {
@@ -23,7 +23,7 @@ const TokenUsage: React.FC<{
}
return (
<TokenUsageWrapper {...rest}>
{tokenResult?.total_tokens && (
{tokenResult?.total_tokens > 0 && (
<span className="text">
{intl.formatMessage({ id: 'playground.tokenusage' })}:{' '}
{tokenResult?.total_tokens}