Bläddra i källkod

fix: openai model name (#1474)

tags/0.3.30
zxhlyh 2 år sedan
förälder
incheckning
6bcafdbc87
Inget konto är kopplat till bidragsgivarens mejladress

+ 2
- 11
web/app/components/app/configuration/config-model/model-name.tsx Visa fil

'use client' 'use client'
import type { FC } from 'react' import type { FC } from 'react'
import React from 'react' import React from 'react'
import { useTranslation } from 'react-i18next'


export type IModelNameProps = { export type IModelNameProps = {
modelId: string modelId: string
] ]


const ModelName: FC<IModelNameProps> = ({ const ModelName: FC<IModelNameProps> = ({
modelId,
modelDisplayName, modelDisplayName,
}) => { }) => {
const { t } = useTranslation()
let name = modelId
if (supportI18nModelName.includes(modelId))
name = t(`common.modelName.${modelId}`)
else if (modelDisplayName)
name = modelDisplayName

return ( return (
<span title={name}>
{name}
<span title={modelDisplayName}>
{modelDisplayName}
</span> </span>
) )
} }

+ 3
- 3
web/app/components/header/account-setting/model-page/model-selector/index.tsx Visa fil

import { AlertCircle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' import { AlertCircle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
import ModelIcon from '@/app/components/app/configuration/config-model/model-icon' import ModelIcon from '@/app/components/app/configuration/config-model/model-icon'
import ModelName, { supportI18nModelName } from '@/app/components/app/configuration/config-model/model-name'
import ModelName from '@/app/components/app/configuration/config-model/model-name'
import ProviderName from '@/app/components/app/configuration/config-model/provider-name' import ProviderName from '@/app/components/app/configuration/config-model/provider-name'
import { useProviderContext } from '@/context/provider-context' import { useProviderContext } from '@/context/provider-context'
import ModelModeTypeLabel from '@/app/components/app/configuration/config-model/model-mode-type-label' import ModelModeTypeLabel from '@/app/components/app/configuration/config-model/model-mode-type-label'
return {} return {}


const res: Record<string, string> = {} const res: Record<string, string> = {}
modelList.forEach(({ model_name }) => {
res[model_name] = supportI18nModelName.includes(model_name) ? t(`common.modelName.${model_name}`) : model_name
modelList.forEach(({ model_name, model_display_name }) => {
res[model_name] = model_display_name
}) })
return res return res
})() })()

Laddar…
Avbryt
Spara