import type { FC, PropsWithChildren } from 'react' import { modelTypeFormat, sizeFormat, } from '../utils' import { useLanguage } from '../hooks' import type { ModelItem } from '../declarations' import ModelBadge from '../model-badge' import FeatureIcon from '../model-selector/feature-icon' import classNames from '@/utils/classnames' type ModelNameProps = PropsWithChildren<{ modelItem: ModelItem className?: string showModelType?: boolean modelTypeClassName?: string showMode?: boolean modeClassName?: string showFeatures?: boolean featuresClassName?: string showContextSize?: boolean }> const ModelName: FC = ({ modelItem, className, showModelType, modelTypeClassName, showMode, modeClassName, showFeatures, featuresClassName, showContextSize, children, }) => { const language = useLanguage() if (!modelItem) return null return (
{modelItem.label[language] || modelItem.label.en_US}
{ showModelType && modelItem.model_type && ( {modelTypeFormat(modelItem.model_type)} ) } { modelItem.model_properties.mode && showMode && ( {(modelItem.model_properties.mode as string).toLocaleUpperCase()} ) } { showFeatures && modelItem.features?.map(feature => ( )) } { showContextSize && modelItem.model_properties.context_size && ( {sizeFormat(modelItem.model_properties.context_size as number)} ) } {children}
) } export default ModelName