fix: stt languages sorting
This commit is contained in:
@@ -30,8 +30,6 @@ const DatasetForm: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const labelRender = (label: string) => {};
|
|
||||||
|
|
||||||
// Initialize profile when open form
|
// Initialize profile when open form
|
||||||
const initProfile = (
|
const initProfile = (
|
||||||
value: string,
|
value: string,
|
||||||
@@ -52,23 +50,15 @@ const DatasetForm: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open && action === PageAction.CREATE) {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
if (
|
if (!profilesOptions || profilesOptions.length === 0) return;
|
||||||
profilesOptions &&
|
|
||||||
profilesOptions.length > 0 &&
|
const throughputProfile = profilesOptions.find(
|
||||||
action === PageAction.CREATE
|
(item) => item.value === ProfileValueMap.ThroughputMedium
|
||||||
) {
|
);
|
||||||
const throughputProfile = profilesOptions.find(
|
if (throughputProfile) {
|
||||||
(item) => item.value === ProfileValueMap.ThroughputMedium
|
initProfile(throughputProfile.value, throughputProfile, datasetList);
|
||||||
);
|
|
||||||
if (throughputProfile) {
|
|
||||||
initProfile(
|
|
||||||
throughputProfile.value,
|
|
||||||
throughputProfile,
|
|
||||||
datasetList
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
init();
|
init();
|
||||||
|
|||||||
@@ -282,10 +282,16 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const languages = selected?.meta?.languages || [];
|
const languages = selected?.meta?.languages || [];
|
||||||
let currentLanguage = [...defaultLanguages];
|
let currentLanguage = [...defaultLanguages];
|
||||||
if (languages.length > 0) {
|
if (languages.length > 0) {
|
||||||
currentLanguage = allLanguages.filter(
|
// sort languages based on the order in the model meta
|
||||||
(lang) =>
|
currentLanguage = [];
|
||||||
languages.includes(lang.value) || languages.includes(lang.label)
|
|
||||||
);
|
languages.forEach((langCode: string) => {
|
||||||
|
const langItem = allLanguages.find((item) => item.value === langCode);
|
||||||
|
if (langItem) {
|
||||||
|
currentLanguage.push(langItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const newConfig = paramsConfig.map((item) => {
|
const newConfig = paramsConfig.map((item) => {
|
||||||
const oItem = _.cloneDeep(item);
|
const oItem = _.cloneDeep(item);
|
||||||
if (item.name === 'language') {
|
if (item.name === 'language') {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const TokenUsage: React.FC<{
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<TokenUsageWrapper {...rest}>
|
<TokenUsageWrapper {...rest}>
|
||||||
{tokenResult?.total_tokens && (
|
{tokenResult?.total_tokens > 0 && (
|
||||||
<span className="text">
|
<span className="text">
|
||||||
{intl.formatMessage({ id: 'playground.tokenusage' })}:{' '}
|
{intl.formatMessage({ id: 'playground.tokenusage' })}:{' '}
|
||||||
{tokenResult?.total_tokens}
|
{tokenResult?.total_tokens}
|
||||||
|
|||||||
Reference in New Issue
Block a user