({ repoId, files, hardwareInfo, onDownload, downloads, installedModels }: HfModelFileListProps)
| 11 | } |
| 12 | |
| 13 | export function HfModelFileList({ repoId, files, hardwareInfo, onDownload, downloads, installedModels }: HfModelFileListProps) { |
| 14 | if (files.length === 0) { |
| 15 | return ( |
| 16 | <div className="text-center py-8 text-dark-text-secondary"> |
| 17 | No GGUF files found for this model |
| 18 | </div> |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | // Group files by quantization quality (already sorted from backend) |
| 23 | const recommendedQuantization = hardwareInfo |
| 24 | ? getRecommendedQuantization(hardwareInfo.vram_gb) |
| 25 | : null; |
| 26 | |
| 27 | return ( |
| 28 | <div className="space-y-3"> |
| 29 | {files.map((file) => { |
| 30 | const isRecommended = recommendedQuantization && file.quantization?.includes(recommendedQuantization); |
| 31 | const modelName = deriveModelName(repoId, file.filename); |
| 32 | const isInstalled = installedModels.some((installed) => installed.name === modelName); |
| 33 | |
| 34 | return ( |
| 35 | <div key={file.filename} className={isRecommended ? 'ring-2 ring-dark-accent rounded-lg' : ''}> |
| 36 | {isRecommended && ( |
| 37 | <div className="px-3 py-1 bg-dark-accent text-white text-xs font-medium rounded-t-lg"> |
| 38 | Recommended for your hardware |
| 39 | </div> |
| 40 | )} |
| 41 | <HfModelFileItem |
| 42 | file={file} |
| 43 | hardwareInfo={hardwareInfo} |
| 44 | onDownload={() => onDownload(file.filename)} |
| 45 | downloadProgress={Array.from(downloads.values()).find( |
| 46 | (d) => d.model_name === modelName |
| 47 | )} |
| 48 | isInstalled={isInstalled} |
| 49 | /> |
| 50 | </div> |
| 51 | ); |
| 52 | })} |
| 53 | </div> |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | function getRecommendedQuantization(vramGb: number): string | null { |
| 58 | if (vramGb >= 10.0) return 'Q6_K'; |
nothing calls this directly
no test coverage detected