feat(civitai): list every file of a version in the gradio model details

The versions table showed only files[0], so precision variants of one
version could not be downloaded. Each file gets its own row under
rowspan version cells, sorted by precision then size, with a variant
column and a star on the primary; rows download by fileId URL and All
variants queues each version's primary from the fetched model. Companion
files pass their own type, and save names carry the precision, then
full/pruned and the file id only when needed to stay unique.
This commit is contained in:
CalamitousFelicitousness
2026-09-13 16:43:44 +01:00
parent b06b538104
commit eb3a062339
3 changed files with 112 additions and 55 deletions
+2
View File
@@ -71,6 +71,8 @@ def file_to_legacy_dict(f) -> dict:
'size': int(f.size_kb * 1024),
'name': f.name,
'type': f.type,
'primary': bool(f.primary),
'metadata': {'fp': f.metadata.fp, 'format': f.metadata.format, 'size': f.metadata.size, 'quantType': f.metadata.quant_type},
'hashes': [h for h in [f.hashes.sha256, f.hashes.autov1, f.hashes.autov2, f.hashes.autov3, f.hashes.crc32, f.hashes.blake3] if h],
'url': f.download_url,
}