Feat: The translation model type options should be consistent with the model's labels. #1036 (#12537)

### What problem does this PR solve?

Feat: The translation model type options should be consistent with the
model's labels. #1036

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2026-01-09 17:39:40 +08:00
committed by GitHub
parent b65daeb945
commit 64b1e0b4c3
11 changed files with 94 additions and 72 deletions

View File

@@ -1,5 +1,6 @@
import { SwitchLogicOperator } from '@/constants/agent';
import { buildOptions } from '@/utils/form';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
export function useBuildSwitchLogicOperatorOptions() {
@@ -10,3 +11,21 @@ export function useBuildSwitchLogicOperatorOptions() {
'flow.switchLogicOperatorOptions',
);
}
export function useBuildModelTypeOptions() {
const { t } = useTranslation();
const buildModelTypeOptions = useCallback(
(list: string[]) => {
return list.map((x) => ({
value: x,
label: t(`setting.modelTypes.${x}`),
}));
},
[t],
);
return {
buildModelTypeOptions,
};
}