model-name.tsx 669 B

1234567891011121314151617181920212223242526272829
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { useTranslation } from 'react-i18next'
  5. export type IModelNameProps = {
  6. modelId: string
  7. }
  8. export const supportI18nModelName = [
  9. 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k',
  10. 'gpt-4', 'gpt-4-32k',
  11. 'text-davinci-003', 'text-embedding-ada-002', 'whisper-1',
  12. 'claude-instant-1', 'claude-2',
  13. ]
  14. const ModelName: FC<IModelNameProps> = ({
  15. modelId,
  16. }) => {
  17. const { t } = useTranslation()
  18. const name = supportI18nModelName.includes(modelId) ? t(`common.modelName.${modelId}`) : modelId
  19. return (
  20. <span title={name}>
  21. {name}
  22. </span>
  23. )
  24. }
  25. export default React.memo(ModelName)