Commit Graph
7 Commits
Author SHA1 Message Date
yetone dd50cbba25 provider: a key's or account's model picker has Select all available (young02036)
young02036 on Discord (after 1a67ca614 fetched each key's own models):
"建议再同步给一个给按钮设置所有可用模型的触发按钮". A key or account's
model picker (the pill under the provider editor's accounts) now has
"Select all available" in its foot, beside All models. For a key it
ticks every model that key's own fetched list has, ones the user
un-ticked before included, since the user asked for it; with no per-key
list (one key, or a fetch not asked per key) and for a signed-in
account it ticks every chip shown. Nothing is saved until Save. The
provider level already had Select all; no new layout.

- provider.KeyListed(id, ref): the models the last fetch marks a key as
  seeing, by listed id; nil when unknown, not none.
- gui: provider/keylisted action returns {models, known}.
- app.js: the button, and the account's kept models joined at draw time
  so a re-draw after ticking shows them. Comments shortened so the core
  script stays under TestCoreScriptBudget with no raise.
- i18n: zh, zh-TW, ja, de for the button and its two tooltips.
- account-models.test.cjs clicks All models by name (the foot now has
  two .action buttons).

What was run (mote, via mote-run). At this tree rebased on 7818dc316:
- TestCoreScriptBudget, the two provider tests, go vet, gofmt,
  account-models-available (60/60), account-models and i18n-keys: ok.
At the same change on 083821dc9 (before the rebase):
- go test ./internal/provider -run 'TestKeyListedIsTheKeysOwnList|TestFetchRefreshesEachKeysModels'
  and ./internal/gui -run TestCoreScriptBudget: ok.
- go vet ./internal/provider ./internal/gui, also GOOS=windows and
  GOOS=linux -tags nogui: ok. gofmt -l: nothing.
- account-models-available.test.cjs (new): chromium + webkit, en zh
  zh-TW ja de, 900 and 420px: 60/60 ok. It checks the relay key ticks
  only its own list's models (an un-ticked one included) and Save posts
  them, a key with no list and a Codex account tick every chip without
  asking keylisted, the button fits its line, and every translation.
- account-models*, account-refresh, gateway-key-models*, provider-*,
  i18n-keys, gui-de, gui-ja, gui-zh-tw: 1219 tests, 1189 ok, 30 red.
  The same 7 files at a clean 083821dc9: 29 of 172 red, the same tests
  (provider-fetch-again #5232, provider-picks-stay and gateway-key-models
  #5233/#4616, provider-mask #5109, provider-typed #4673,
  provider-levels-scroll #4395, provider-models-rest #4396). None new.

Broken by hand: the new GUI test on origin/main's app.js: 0/60 (each
waits for the button).

Not tried: a real relay with per-group keys (the relay is a fixture),
and the full go test ./... before the tag (run after, issues filed for
any red).
2026-11-04 21:52:05 +08:00
yetone 91ffe54294 gui: account-models' still-row check waits for the dialog's soft refresh
A click that redraws the editor gives its dialog the swap class, whose
content-in animation starts 2px low. WebKit (on the WSL box) can hold
that animation at currentTime 0 past the test's 200ms wait, so the
row measured 2px down: "row moved 81 !== 79". Probed: the dialog's
transform was matrix(1,0,0,1,0,2) with content-in running@0. It now
waits for the dialog's animations to finish before measuring.

On origin/main 03f3e1528 the key case failed 2 of 2 WebKit runs and the
Codex case 1 of 8; with the refresh on each account row (the commit before)
the Codex case failed about 5 of 8. After: WebKit 60/60 over five runs,
Chromium 12/12, on wsl-run (mote's WebKit is broken, #4125).
2026-10-31 10:40:12 +08:00
yetone ce8b67de37 gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.

nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.

What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
  1174 pages); against this tree: its only reds were my own probe copies
  of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
  first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
  red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
  32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
  green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
  on a 5s waitForFunction at line 115 (a wait after load, not the
  navigation), at load ~230.

Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
2026-10-31 02:09:18 +08:00
yetone 18005c8039 gui: a provider editor's account rows end at one edge, their settings under ⋯
The owner, 10-29, on Claude Code's editor sheet: its left and right edges
weren't the same, Make first sat alone on a line under the name, and a
band of hover pills took room it didn't show.

Each account row is now a line (dot, name, plan, what is set, then the
status and First or Make first at the right end) and the quota under it.
The settings that aren't set (models, usage cap, requests at once) and
Remove or Sign out wait under ⋯ on a line of their own, which ⋯ opens and
closes. The editor remembers that per row across redraws. A set pill stays
on the line, and a lane pill moves between them as its account starts or
stops running, but not while its menu or box is open. A signed-out
account keeps Sign in again and Remove on its line, wrapping under the
name where they don't fit. The editor's label column fits its labels,
a list's label stands on its first row, every row of the accounts box is
ruled off from the one above, and in the web layout ⋯ is always shown. New
string "Settings for {user}" is in all five languages.

core_budget_test: app.js stays in its budget (1,311,731, comments cut
down). The core's scripts go to 1,532,459. Main had 233 bytes of room
there, so the budget is raised to the exact size with no room added,
as the 10-28/29 editor entries did.

Run (on mote, at this tree, rebased on abd94e0b1):
- go test -run Budget ./internal/gui/: ok.
- node --test on account-row-line (new), account-cap, account-models,
  lane-limit, codex-signout, own-signin-remove, i18n-keys and i18n:
  82 pass, 0 fail.
- The full GUI set of 70 files, at base 2da7293d4 before the trim: 1227
  pass, 17 fail. Every red also fails on main:
  - gateway-caller-keys (#3797);
  - gateway-key-models webkit en (#4081);
  - key-replace 420 webkit (#4126);
  - rest-try-now 420 (#4127);
  - key-weight-fit en 900 in both engines (#4295, filed now). That is
    the key rows' own hover squeeze, which this change leaves alone.

Broken by hand: account-row-line on main's assets (MAGPIE_ACC_ASSETS) is
red in both engines: Make first on a line of its own, and hidden pills
taking room.

Not run: the full GUI set again after the comment trim and the move to
abd94e0b1. A provider's key rows (renderKeyAccounts) keep the old hover
layout (#4295). On a phone, the sheet's two edges aren't compared,
because a phone's scroll bar takes no room. Headless WebKit draws a
classic bar there.
2026-10-29 22:58:08 +08:00
yetone 87d703c5c2 gui: the provider editor's Save keeps the account-model picks (#2862, LoKi)
With an account's model picker open, Save saved the provider and closed
the editor, and the picks were dropped while Save reported success. Both
Save paths (subscription, and key or custom) now post the picks to
provider/accountmodels first, then save. An empty pick list stops Save
with a warning ("Pick at least one model for the account, or choose All
models", in zh, zh-TW, ja and de too). Open picks count as unsaved
changes, and Cancel drops them. LoKi (lokic7123-star) reported it and
proposed blocking Save; this carries the picks instead.

Run at the stacked tree (this commit with #2695 and #2554, on ef6f3749d):
- gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui, and
  GOOS=windows: ok.
- set -o pipefail; go test -count=1 -timeout 45m ./... under the suite
  lock (TestCoreScriptBudget included): every package ok.
- GUI, chromium and webkit, every language each file covers:
  account-models 24/24, i18n-keys, plugin-keyless-signin, and 56 related
  files (provider editor, models, i18n). That run found
  models-select-all-api red 15/16 from this change (providers.providers
  read before the list loaded); fixed with an optional chain and the file
  run again with account-models: 44/44.
Red on the old code: 8 of account-models' tests in chromium (the three
new Save tests per language).
Not tried: the real app.
2026-10-22 20:51:18 +08:00
yetone 8339e82c08 gui: a weighted key's name is no longer squeezed out, and First / Make first stay on one line (#841, dengtongcai) — with a relay's routing set to By weight, each key's row gained a weight chip, and the row's hover-only controls (All models, the protocol picker, Remove) kept their full width while hidden, so the key's name was squeezed to "…" or to nothing, and "首选" / "Make first" broke over two lines in a narrow window. In a key's row these controls now take no room until the row is hovered or they have focus or are open (max-width 0); on hover the room comes from the row's free space, else the masked key's, and the All models badge gives its own up first. First and Make first never wrap. Nothing else in the row moves, and a click still scrolls nothing. key-weight-fit.test.cjs (WebKit, en and zh, 900/640/520/440px: the name whole, the masked key whole where it has room, everything inside the card, First and Make first on one line, Remove whole on hover, no row overflows, no left border) fails without the change (en 900, 520, 440 and zh 440). account-models and api-key-usage now hover a key's row before using its All models / Remove, as a user does. key-weight, account-arrange, account-cap, account-return, gateway-key-*, key-import, routing-*, click-scroll and the rest of the account-row GUI tests pass in WebKit. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. 2026-10-05 17:50:00 +08:00
yetone 01d595817c providers: each account of a subscription, and each key, can be kept for some of the provider's models only (#474: 增加账号级别的模型选项, a low-quota but verified account kept for the cheap models) — every account or key a provider had served every model it did, so one couldn't be spared for some. An account's or key's row in its provider's editor now has a models badge: a click opens the provider's models as chips, Save keeps the account for those picked, All models gives it every one again; one kept for some says how many, always shown. magpie provider account-models <id> [account|key [models…|all]] does the same and lists them. It is kept in providers.json as accountModels, an account by its name in lower case, a key by its id; one not in it serves every model, as before. The gateway never sends a model to an account or key whose list leaves it out, in every routing mode, in drag order, in a group and as a fallback, and never falls back to it all the same; the trace says it was left out as set to serve other models. When every account or key there is leaves the model out, the request is refused with a 403 saying so and how to change it, not "none of X's models is ready". TestKeyModelsNarrowCandidates, TestAccountModelsNeverChosen, TestAccountModelsCmd and account-models.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; account-models, click-scroll, old-webkit, account-arrange, account-proxy, account-return, routing-account-order, panel-routing, unlisted-models pass. 2026-10-02 05:50:23 +08:00