From 1bd31d293677c572f899d09f687bf894a871ec05 Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 6 Feb 2026 15:08:10 +0800 Subject: [PATCH] fix: stt languages sorting --- src/pages/benchmark/forms/dataset.tsx | 26 ++++++------------- .../playground/components/ground-stt.tsx | 14 +++++++--- .../playground/components/token-usage.tsx | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/pages/benchmark/forms/dataset.tsx b/src/pages/benchmark/forms/dataset.tsx index 5d2b74b6..8dd887e9 100644 --- a/src/pages/benchmark/forms/dataset.tsx +++ b/src/pages/benchmark/forms/dataset.tsx @@ -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(); diff --git a/src/pages/playground/components/ground-stt.tsx b/src/pages/playground/components/ground-stt.tsx index 5f1879b3..fdf99739 100644 --- a/src/pages/playground/components/ground-stt.tsx +++ b/src/pages/playground/components/ground-stt.tsx @@ -282,10 +282,16 @@ const GroundSTT: React.FC = 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') { diff --git a/src/pages/playground/components/token-usage.tsx b/src/pages/playground/components/token-usage.tsx index 862d5847..2970ad55 100644 --- a/src/pages/playground/components/token-usage.tsx +++ b/src/pages/playground/components/token-usage.tsx @@ -23,7 +23,7 @@ const TokenUsage: React.FC<{ } return ( - {tokenResult?.total_tokens && ( + {tokenResult?.total_tokens > 0 && ( {intl.formatMessage({ id: 'playground.tokenusage' })}:{' '} {tokenResult?.total_tokens}