[FEATURE]: Configurable sort criterion for models within each group in the /models picker

Offen
#66,988 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
json, typescript

Rechercherichtung

Start with packages/tui/src/component/dialog-model.tsx and its sortModelOptions() function, then trace how configuration is loaded before reading packages/cli/src/commands/handlers/models.ts for the existing alphabetical comparison. Add the configurable models.sort option with release-desc, release-asc, name-asc, and name-desc, preserving group order, Favorites, Recent, and fuzzy-search behavior. Done means the /models picker respects the configured within-group order while the default remains release date descending.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area/tui platform/macos type/feature version/v2
Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

Make the sort criterion of the models within each group configurable of the /models picker (provider groups and the "Free" group).

Current behavior

The server returns chat models sorted by release date, newest first (packages/core/src/model.ts: .sort((left, right) => right.time.released - left.time.released)). The TUI picker (packages/tui/src/component/dialog-model.tsx → sortModelOptions()) only orders the provider groups and keeps the release-date order inside each group.

With large catalogs (opencode, opencode-go, google-vertex, …) this makes it hard to find a model by name when scrolling a group: models of the same family end up scattered by release date.

The CLI already does the opposite: opencode models sorts its output alphabetically (packages/cli/src/commands/handlers/models.ts: .toSorted((a, b) => a.localeCompare(b))), so the two views of the same catalog disagree.

Proposal

Make the sort criterion of the /models picker configurable, e.g. in cli.json:

{ "models": { "sort": "release-desc" } }
Value Order inside each group
release-desc (default, current behavior) newest first
release-asc oldest first
name-asc alphabetical by display name
name-desc reverse alphabetical

Both criteria are useful: newest-first to spot what was just released, alphabetical to find a known model by name. Implementation-wise this is a final tie-breaker in sortModelOptions() (time.released or title.localeCompare, with the chosen direction). Group order, Favorites, Recent and fuzzy search results would stay as they are.

A picker keybind to cycle the criterion on the fly (like other *.cycle keybinds) would be a nice extra, but the config option alone would solve it.

Why not a plugin

A V2 plugin can filter the catalog (ctx.model.transform), but it cannot control picker order. The only lever is rewriting model.time.released, which also feeds default-model selection and the model metadata exposed to agents, so it is not a safe workaround. (#45412 asked for a plugin ordering API for the same reason and was auto-closed for template compliance.)

Related
  • #57195: configurable provider group order (open). This request is complementary: order of models inside a group.
  • #22593 (Filter and sort models), #38228 (custom order UI), #51941 (user-defined order in config): closed as not planned / stale; they proposed broader custom ordering. This one only asks for a few built-in sort criteria (release date or name, each in both directions).
Environment
  • opencode version: 2.4.2
  • OS: macOS 12.7.6 (Darwin 21.6.0)
  • Terminal: tmux 3.5a
Vorherrschende Sprache
TypeScript
Sterne
230k
Forks
31.3k
Ø Merge
5 Std. 32 Min.
Gemergte PRs (30 T.)
453

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus anomalyco/opencode

Alle Issues in anomalyco/opencode

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.