studio: sort GGUF quants largest-first so best quality that fits is at the top

This commit is contained in:
Daniel Han 2026-03-15 05:46:25 +00:00
commit dd2d979b40

View file

@ -969,8 +969,9 @@ def list_gguf_variants(
def _sort_key(v: GgufVariantInfo) -> tuple:
is_recommended = v.quant == best_quant
is_ud = v.quant.startswith("UD-")
# (0, ...) recommended | (1, 0, size) other UD | (1, 1, size) non-UD
return (0 if is_recommended else 1, 0 if is_ud else 1, v.size_bytes)
# (0, ...) recommended | (1, 0, -size) other UD | (1, 1, -size) non-UD
# Negative size so largest (best quality) appears first.
return (0 if is_recommended else 1, 0 if is_ud else 1, -v.size_bytes)
variants.sort(key = _sort_key)