Skip to content

ModelPanelFormatter

Category: UI

Source: model_panel_formatter.dart

Enums

ModelAvailability

Per-row availability hint — today only Ollama reports more than [unknown]. Lets the picker annotate catalog rows with "not pulled" and surface tag-only installs the user may want to pick.

ValueDescription
String
String
ModelDef
ModelAvailability

Classes

ModelPanelBuilder

Width-aware builder for the model picker.

Holds the row data and re-formats on demand, so the picker can reflow its columns as the user resizes the terminal.

Properties

PropertyTypeDescription
initialIndexintIndex into [entries] for the currently active model, or 0 if none match.
entriesList<CatalogRow>Flat list of entries corresponding 1:1 with the builder's rows.
rowCountint get
flatInitialvar
headersfinal
lastProviderString?
indexedfinal
tablefinal
rowsfinal
rowsreturn
providerNameString
installedfinal
outfinal
cataloguedfinal
outreturn
notesfinal
prefixfinal
rowCountint get

Methods

List<String> renderHeader(int width)
String renderRow(int index, int width)
bool Function(ProviderDef)

Functions

`ModelPanelBuilder buildModelPanel(

List<CatalogRow> entries, { required ModelRef currentRef, })`

Builds a [ModelPanelBuilder] that reflows column widths with the terminal. Provider headers are shown only on the first row of each provider group; the current model is marked with a filled dot.

`List<CatalogRow> mergeOllamaDiscovery(

List<CatalogRow> rows, List<OllamaInstalledModel> installedTags, { String providerName = 'Ollama', })`

Merge Ollama's /api/tags output into a flat catalog row list.

  • Rows whose provider is ollama get [ModelAvailability.installed] if the catalog id matches a pulled tag, else [ModelAvailability.notInstalled].
  • Pulled tags that have no catalog entry are appended as synthesised rows with [ModelAvailability.installedOnly]; they use the tag as both id and display name, carry no capability claims, and render with the [local] marker.
  • Non-Ollama rows are returned unchanged.
  • [installedTags] being empty (daemon down, timeout) leaves catalog rows untouched — no false "not pulled" markers when we don't know.

Released under the MIT License.