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

オープン
#66,988 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
70/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
json, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
230k
フォーク
31.3k
平均マージ
5時間 32分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。