feat: support show model display name (#887)

This commit is contained in:
Joel
2023-08-17 15:13:35 +08:00
committed by GitHub
parent f42e7d1a61
commit cd78adb0ab
5 changed files with 20 additions and 6 deletions

View File

@@ -257,7 +257,7 @@ const ConfigModel: FC<IConfigModelProps> = ({
providerName={provider}
/>
<div className='text-[13px] text-gray-900 font-medium'>
<ModelName modelId={selectedModel.name} />
<ModelName modelId={selectedModel.name} modelDisplayName={currModel?.model_display_name} />
</div>
{disabled ? <InformationCircleIcon className='w-3.5 h-3.5 text-[#F79009]' /> : <Cog8ToothIcon className='w-3.5 h-3.5 text-gray-500' />}
</div>

View File

@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'
export type IModelNameProps = {
modelId: string
modelDisplayName?: string
}
export const supportI18nModelName = [
@@ -16,9 +17,14 @@ export const supportI18nModelName = [
const ModelName: FC<IModelNameProps> = ({
modelId,
modelDisplayName,
}) => {
const { t } = useTranslation()
const name = supportI18nModelName.includes(modelId) ? t(`common.modelName.${modelId}`) : modelId
let name = modelId
if (supportI18nModelName.includes(modelId))
name = t(`common.modelName.${modelId}`)
else if (modelDisplayName)
name = modelDisplayName
return (
<span title={name}>