import Markdown from 'react-markdown' import Image from 'next/image' import { ModelSource } from '@janhq/core' import { DownloadIcon, FileJson } from 'lucide-react' import rehypeRaw from 'rehype-raw' import ModelLabel from '@/containers/ModelLabel' import ModelItemHeader from '@/screens/Hub/ModelList/ModelHeader' import { markdownComponents } from '@/screens/Thread/ThreadCenterPanel/TextMessage/MarkdownUtils' import { toGigabytes } from '@/utils/converter' import { extractDescription } from '@/utils/modelSource' import '@/styles/components/model.scss' type Props = { model: ModelSource onSelectedModel: () => void } const ModelItem: React.FC = ({ model, onSelectedModel }) => { return (
{toGigabytes(model.models?.[0]?.size)}
{extractDescription(model.metadata?.description) || '-'}
{(model?.author ?? model?.metadata?.author) && (

{model.id?.includes('huggingface.co') && ( <> {' '} )}{' '} {model?.author ?? model?.metadata?.author}

)} {model.models?.length > 0 && (

{model.models?.length}{' '} {model.type === 'cloud' ? 'models' : 'versions'}

)} {model.metadata?.downloads > 0 && (

{model.metadata?.downloads}

)}
) } export default ModelItem