feat: mark shared draft variants on the sidecar badge

The shared marker moves from a 'shared' suffix on the quant name to the
sidecar badge (MTP-SHARED); draft select options prefix the badge text
so both variants of the same quant stay distinguishable in the dropdown,
and the download CTA shows e.g. 'Download Q4_K_M + MTP-SHARED'.

Assisted-by: pi:GLM-5.3-Flash
This commit is contained in:
Aleksander Grygier
2026-09-04 20:07:37 +02:00
parent 5079be7fa5
commit c26ffe3440
4 changed files with 13 additions and 9 deletions
@@ -131,7 +131,8 @@
let draftOptions = $derived(
draftFiles.map((f) => ({
...optionFor(f),
badge: HuggingFaceService.extractQuantMeta(f.path)?.sidecar ?? null
badge: HuggingFaceService.extractQuantMeta(f.path)?.sidecar ?? null,
shared: HuggingFaceService.extractQuantMeta(f.path)?.shared ?? false
}))
);
@@ -347,7 +348,7 @@
let downloadLabel = $derived.by(() => {
const main = mainEntry ?? commandMain;
const draftLabel = draftSidecar
? `${draftSidecar.toUpperCase()}${draftShared ? ' shared' : ''}`
? `${draftSidecar.toUpperCase()}${draftShared ? '-SHARED' : ''}`
: undefined;
let label = 'Download';
@@ -9,7 +9,7 @@
/** Full command text, copied to the clipboard as-is. */
command: string;
baseOptions: QuantOption[];
draftOptions: (QuantOption & { badge: ModelSidecar | null })[];
draftOptions: (QuantOption & { badge: ModelSidecar | null; shared: boolean })[];
/** Value of the base quant select, mirrored by the parent. */
basePick: string;
/** Value of the draft quant select; empty when no draft is picked. */
@@ -105,7 +105,10 @@
>
{#each draftOptions as option (option.path)}
<option disabled={option.disabled} value={option.path}>
<!-- {option.badge ? `${option.badge.toUpperCase()} ` : ''} -->
{#if option.shared}
{option.badge?.toUpperCase()}-SHARED
{/if}
{option.label}
</option>
{/each}
@@ -44,7 +44,7 @@
<span
class="rounded-md bg-primary px-1 py-0.5 text-[10px] font-semibold tracking-wide text-primary-foreground uppercase"
>
{meta.sidecar}
{meta.sidecar}{meta.shared ? '-shared' : ''}
</span>
{/if}
@@ -76,7 +76,7 @@
<span
class="rounded-md bg-primary px-1 py-0.5 text-[10px] font-semibold tracking-wide text-primary-foreground uppercase"
>
{meta.sidecar}
{meta.sidecar}{meta.shared ? '-shared' : ''}
</span>
{/if}
@@ -33,11 +33,11 @@ export function classify(path: string): 'main' | 'draft' | 'aux' {
return isAuxSidecar(sidecar) ? 'aux' : 'draft';
}
/** Display label of a file: its quant (plus `shared` for shared draft variants), else the file name without the extension. */
/** Display label of a file: its quant, else the file name without the extension. */
export function labelFor(path: string): string {
const meta = HuggingFaceService.extractQuantMeta(path);
const quant = HuggingFaceService.extractQuantMeta(path)?.quant;
if (meta?.quant) return meta.shared ? `${meta.quant} shared` : meta.quant;
if (quant) return quant;
const basename = path.split('/').pop() ?? path;