Skip to content

feat(accounts): pick upstream models before they enter the whitelist - #223

Merged
HTExplicit merged 3 commits into
mainfrom
feat/upstream-model-picker
Oct 2, 2026
Merged

HTExplicit merged 3 commits into
mainfrom
feat/upstream-model-picker

Conversation

@HTExplicit

Copy link
Copy Markdown
Owner

Summary

When an admin clicks 「同步上游支持的模型」 in the account create/edit model whitelist, the synced models no longer go straight into the whitelist. A picker dialog opens on top of the account modal, and only the checked models go into the whitelist. Frontend only, no backend or migration change. Owner approved the behaviour on 2026-10-02 from a local preview.

  • Rows: the upstream models, plus whitelist entries the upstream did not return (tagged 「上游未返回」). The whole list is sorted by model ID. Upstream models the whitelist lacks are tagged 「新增」.
  • Defaults: every upstream model starts checked; 「上游未返回」 rows start unchecked.
  • Toolbar: search by ID or display name; 全选 and 反选 act on the whole list, ignoring search and filter; there is no 取消全选. A status filter (全部 / 已勾选 / 未勾选 / 新增 / 上游未返回) can be combined with search. Each row shows display name, context window and max output, and has a copy-ID button.
  • Notices: a configured-source list and metadata warnings are shown inside the dialog instead of as toasts.
  • Footer: shows 「将新增 X 个,移除 Y 个」. 确认 is disabled when nothing is checked, because an empty whitelist means no model restriction.
  • Confirm: the whitelist becomes the checked set: existing entries keep their order and new ones are appended. It only updates the form; the account still saves through its own button.
  • Cancel / Esc / X: the whitelist is unchanged, and the synced models are not kept as dropdown candidates.
  • Long lists: windowed rendering, following the DataTable precedent. Rows skip re-render on toggle. Measured in a Vite dev harness at 1502 rows: open about 40 ms, 反选/全选 under 20 ms.

Out of scope and unchanged: the Antigravity mapping sync, 「同步最新支持模型」, bulk edit, channel model sync, and all backend code.

Test plan

  • vitest run src/components/account/__tests__/ModelWhitelistSelector.spec.ts src/i18n/__tests__/localeKeyCompleteness.spec.ts: 41 passed
  • vue-tsc --noEmit
  • eslint on the changed .vue/.ts files
  • Local preview with the real components and mock sync data: light/dark, console theme on/off, 375px width, zh/en, and 1500 rows
  • Not run: the full frontend suite, backend tests and real model calls (frontend-only change)

🤖 Generated with Claude Code

Codex and others added 3 commits October 2, 2026 12:28
Syncing upstream models now opens a picker over the account dialog instead of appending every model.
It lists upstream models and whitelist entries sorted by ID, tags 新增 / 上游未返回, starts with upstream models
checked, and offers search, 全选 / 反选, a status filter and capability details. Only Confirm changes the
whitelist (kept entries first, then new models) and forwards the sync result; Cancel leaves both untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ocus stable

- P1: past 100 visible rows the picker list renders only the rows near view
  (@tanstack/vue-virtual, DataTable precedent: measured row heights keyed by
  model ID, spacer items, caches reset for a new list); rows are v-memo'd on
  their row, index and checked state, so a toggle patches one row; capability
  lines are built when a row first renders. 全选 / 反选 / counter / summary
  still cover the whole list.
- P2: the list area keeps the height it opened with (the whole list's, at
  most 50vh); the empty message sits inside it, so filtering and searching no
  longer resize the dialog.
- A1: toggling a focused row out of the 已勾选 / 未勾选 view moves the focus to
  the row taking its place (the previous one when it was last, the search when
  none is left).
- A2: each checkbox is described by its row's tag and capability line.
- Tests: empty upstream list branch, checked state read from the checkbox,
  case-insensitive ID search, a 300-row windowed list with whole-list bulk
  actions, focus hand-off, row descriptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ggling

Turn off scroll anchoring on the list so a focused row checkbox cannot push a
long jump scroll past its target, and keep a windowed list windowed when a
toggle under the checked/unchecked filter takes it down to the threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HTExplicit
HTExplicit merged commit e307d39 into main Oct 2, 2026
18 checks passed
@HTExplicit
HTExplicit deleted the feat/upstream-model-picker branch October 2, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant