import type { FC } from 'react' import { useTranslation } from 'react-i18next' import { RiAddLine, } from '@remixicon/react' import type { ModelProvider, } from '../declarations' import { ConfigurationMethodEnum } from '../declarations' import { DEFAULT_BACKGROUND_COLOR, modelTypeFormat, } from '../utils' import { useLanguage, } from '../hooks' import ModelBadge from '../model-badge' import ProviderIcon from '../provider-icon' import s from './index.module.css' import { Settings01 } from '@/app/components/base/icons/src/vender/line/general' import Button from '@/app/components/base/button' import { useAppContext } from '@/context/app-context' type ProviderCardProps = { provider: ModelProvider onOpenModal: (configurateMethod: ConfigurationMethodEnum) => void } const ProviderCard: FC = ({ provider, onOpenModal, }) => { const { t } = useTranslation() const language = useLanguage() const { isCurrentWorkspaceManager } = useAppContext() const configurateMethods = provider.configurate_methods.filter(method => method !== ConfigurationMethodEnum.fetchFromRemote) return (
{ provider.description && (
{provider.description[language] || provider.description.en_US}
) }
{ provider.supported_model_types.map(modelType => ( {modelTypeFormat(modelType)} )) }
{ configurateMethods.map((method) => { if (method === ConfigurationMethodEnum.predefinedModel) { return ( ) } return ( ) }) }
) } export default ProviderCard