@@ -299,6 +299,43 @@ function Format-LocalLLMSpectreFitCell {
299299 return " [$color ]$marker [/]$star$QuantKey "
300300}
301301
302+ function Format-LocalLLMSpectreCatalogQuants {
303+ param (
304+ [Parameter (Mandatory = $true )]$Def ,
305+ [int ]$Limit = 10
306+ )
307+
308+ if (-not $Def.ContainsKey (" Quants" )) {
309+ return " [grey50](single file)[/]"
310+ }
311+
312+ $quantCells = @ (
313+ foreach ($qk in $Def.Quants.Keys ) {
314+ $fit = Get-QuantFitClass - Def $Def - QuantKey $qk
315+ Format-LocalLLMSpectreFitCell - QuantKey $qk - FitClass $fit - IsDefault:($qk -eq $def.Quant )
316+ }
317+ )
318+
319+ if ($quantCells.Count -le $Limit ) {
320+ return ($quantCells -join ' ' )
321+ }
322+
323+ $hidden = $quantCells.Count - $Limit
324+ return (@ ($quantCells | Select-Object - First $Limit ) -join ' ' ) + " [grey50]+$hidden [/]"
325+ }
326+
327+ function Format-LocalLLMSpectreCatalogContexts {
328+ param ([Parameter (Mandatory = $true )]$Def )
329+
330+ $contextLabels = @ (
331+ $Def.Contexts.Keys | ForEach-Object {
332+ if ([string ]::IsNullOrWhiteSpace($_ )) { " def" } else { $_ }
333+ }
334+ )
335+
336+ return ConvertTo-LocalLLMSpectreSafe ($contextLabels -join ' ' )
337+ }
338+
302339function Show-ModelCatalogSpectre {
303340 param ([switch ]$All )
304341
@@ -319,43 +356,29 @@ function Show-ModelCatalogSpectre {
319356
320357 foreach ($key in $visibleKeys ) {
321358 $def = Get-ModelDef - Key $key
322- $tier = Get-ModelTier - Def $def
323-
324- $tierLabel = switch ($tier ) {
325- ' recommended' { ' [green]recommended[/]' }
326- ' experimental' { ' [yellow]experimental[/]' }
327- ' legacy' { ' [grey50]legacy[/]' }
328- default { ConvertTo-LocalLLMSpectreSafe $tier }
329- }
330-
331- if ($def.ContainsKey (" Quants" )) {
332- $quantCells = foreach ($qk in $def.Quants.Keys ) {
333- $fit = Get-QuantFitClass - Def $def - QuantKey $qk
334- Format-LocalLLMSpectreFitCell - QuantKey $qk - FitClass $fit - IsDefault:($qk -eq $def.Quant )
335- }
336- $quants = ($quantCells -join ' ' )
337- $defaultQuant = " [cyan]$ ( $def.Quant ) [/]"
338- } else {
339- $quants = " [grey50](single file)[/]"
340- $defaultQuant = " [grey50]—[/]"
341- }
342-
343- $contextLabels = @ ($def.Contexts.Keys | ForEach-Object {
344- if ([string ]::IsNullOrWhiteSpace($_ )) { " default" } else { $_ }
345- })
346- $contexts = ($contextLabels -join ' · ' )
359+ $quants = Format-LocalLLMSpectreCatalogQuants - Def $def
347360
348361 $rows.Add ([pscustomobject ]@ {
349- Key = " [white]$key [/]"
350- Name = ConvertTo-LocalLLMSpectreSafe $def.DisplayName
351- Tier = $tierLabel
352- Default = $defaultQuant
353- Quants = $quants
354- Contexts = ConvertTo-LocalLLMSpectreSafe $contexts
362+ Key = " [white]$key [/]"
363+ Name = ConvertTo-LocalLLMSpectreSafe $def.DisplayName
364+ Quants = $quants
365+ Ctx = Format-LocalLLMSpectreCatalogContexts - Def $def
355366 }) | Out-Null
356367 }
357368
358- $rows | Format-SpectreTable - Border Rounded - Color Blue - AllowMarkup - Wrap | Out-Host
369+ $keyWidth = 14
370+ $nameWidth = 36
371+ $ctxWidth = 30
372+ $quantWidth = 44
373+
374+ $properties = @ (
375+ @ { Name = ' Key' ; Expression = { $_.Key }; Width = $keyWidth }
376+ @ { Name = ' Name' ; Expression = { $_.Name }; Width = $nameWidth }
377+ @ { Name = ' Quants' ; Expression = { $_.Quants }; Width = $quantWidth }
378+ @ { Name = ' Ctx' ; Expression = { $_.Ctx }; Width = $ctxWidth }
379+ )
380+
381+ $rows | Format-SpectreTable - Property $properties - Border Rounded - Color Blue - AllowMarkup - Wrap | Out-Host
359382
360383 Write-Host " "
361384 Write-Host " Quant cells: " - ForegroundColor DarkGray - NoNewline
0 commit comments