Commit Graph
3 Commits
Author SHA1 Message Date
yetone 91379b9339 settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name
the client asked for (a group or provider/model id), groups that aren't
aggregates included, and the only way back to the vendor's own text was the
X-Magpie-Response-Model header, which their client can't send.

Settings › Models › Replies › Model name in replies (replyModel), picked
from the app's menu, in en, zh, zh-TW, ja and de:
- "" the model asked for (the default, as now);
- member: magpie's provider/model that answered (what memberModel did;
  Claude Code, Claude Desktop and Codex still get the name asked for);
- vendor: the vendor's own text, for every agent, the vendorNamed three
  included, as every agent got before v0.1.2473 and as the header's
  "vendor" already gave them.
X-Magpie-Response-Model (asked, member or vendor) still picks for its
request; an unknown value falls through to the setting, as before.

memberModel is folded in without changing anyone's choice: a file with
memberModel on reads as replyModel member, an explicit replyModel wins, and
memberModel is written beside it as a mirror so an older magpie reads the
same. An older page sending only memberModel changes the setting only when
its switch moved (a vendor choice survives its saves). The CLI's set/reset
goes through Keys/Choices (replyModel in place of memberModel).

app.js's row is paid for by five comments in Settings' code cut down:
app.js is 145 bytes under its base, no budget raise.

Run on mote at this head (rebased on origin/main b328a7790):
- gofmt -l clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows
  go vet ./... clean.
- go test -tags nogui -count=1 -timeout 45m ./internal/settings
  ./internal/settingsapi ./internal/gui ./internal/cli ./internal/gateway:
  settings, settingsapi, gui, cli ok; gateway ok but
  TestCodexPoolSaysTheClientsVersion, red in the full package and green
  alone (#4807, another test's Codex identity; passed alone at the
  previous head).
- GUI (node --test, chromium + webkit): reply-model-setting (5 languages x
  1100/420, plus default-to-member), loop-guard-setting, i18n-keys,
  account-discovery, disabled-models, masking-records,
  refusal-retries-setting: 222 pass, 0 fail.
- Whole GUI suite earlier at d73b208ac's tree: reds in account-eye (#4244)
  and segs-press-redraw's "every Settings option" (#4566, searchAllRow;
  red the same at origin/main b328a7790, run alone), plus load reds in
  unrelated pages; none in Settings' Replies.

Rebased again onto f3681b90c (Agents page, usage, claude /usage) and
run there: internal/gui and settingsapi -run Budget|SettingsSave|Keys ok,
settings TestReplyModel ok, i18n-keys + reply-model-setting 26/26.

Broken by hand (each red, then put back):
- replyNamingOf ignoring the vendor setting: TestReplyNamesMember's
  vendor, vendor+codex, vendor+claude code cases red on every protocol.
- normal() without the memberModel fold: TestReplyModelFoldsMemberModel
  and TestReplyNamesMember's "old file on" red.
- Merge without the old page's memberModel rule: TestReplyModelSaves'
  old page turns it on / off red.
- settings_keep_test.go went red at the earlier head (MemberModel not sent),
  fixed by setting replyModel member there.

Not tried: a real vendor account through a real group; the GUI test was not
run against the old app.js (the row doesn't exist there).
2026-11-03 05:38:18 +08:00
yetone ed978e560f gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray
Quit asks while agents go through magpie (8826a15ea), and a switch in
Settings to turn it on and off again.

- The question (quitask.js, an in-app sheet) has a "Don't ask again"
  checkbox above its buttons, unticked each time. It goes with the Quit
  chosen: Quit and Disconnect and quit post window/quit?now=1&noAsk=1,
  which saves settings.quitNoAsk (settings.SetQuitNoAsk, under the file
  lock) before quitting; a failed save keeps magpie open. Cancel saves
  nothing.
- AskQuit quits at once when quitNoAsk is set (quitAtOnce); otherwise as
  before. The default is unchanged: it asks.
- Settings › General has "Ask before quitting" On/Off (segs, app-only),
  after Open at login. settingsapi.Keys lists quitNoAsk, and Merge carries
  it when a save doesn't send it, so the tray panel or an older page
  can't turn the question back on.
- zh, zh-TW, ja, de strings. Five app.js comments shortened to stay in
  the core script budget (no raise).

Run at the pushed head (on origin/main f95bacdfb), on mote:
- gofmt clean; go vet darwin, linux, windows (nogui too).
- go test internal/settings, internal/settingsapi ok; internal/gui
  -run "Budget|Quit" ok.
- internal/cli: TestEveryRouteHasACommandOrIsNamed red for
  POST /api/usage/checkin-account, from e87140242, filed as #4826; this
  change adds no route.
- GUI, chromium and webkit: quit-ask-setting (25: en, zh, zh-TW, ja, de
  at 1100 and 420), quit-ask (35), settings-general, settings-sections,
  settings-search, settings-tabs-stick, wsl-agents-setting, agent-prefs,
  i18n-keys, old-webkit, auto-backup, all pass.

Broken by hand, each red:
- api.go's noAsk ignored: TestQuitDontAskAgain "wasn't saved".
- quitAtOnce not reading the setting: TestQuitDontAskAgain "still asks".
- Merge carry dropped: TestQuitNoAskKeptUnlessSent.
- SetQuitNoAsk saving false: TestSetQuitNoAsk.
- quitask.js without &noAsk=1: quit-ask's two Don't ask again tests.

Not tried: a real tray Quit with the box ticked in the built app on
macOS, Windows or Linux; only the sheet in Playwright and the handler
in Go. Not the whole GUI suite.
2026-11-02 18:53:07 +08:00
yetone 5dfbca6274 cli: magpie settings list|get|set|reset, through the window's own save (#4745)
Stage 1 of #4745 (StringKe): every setting POST /api/settings saves can
be read and set from the terminal.

- internal/settingsapi holds the save the handler made: Merge (the
  carry of keys a page leaves out, moved verbatim from api.go, plus
  upstream's RouterNote line), the vision/imageGen/searcher checks,
  settings.Save's own checks, catalog.Touched. POST /api/settings and
  `magpie settings` both call settingsapi.Apply, so a value is checked
  and saved one way. It sits outside internal/gui so the nogui build
  has it.
- `magpie settings` (list, the default, with value, default and
  choices; get; set; reset to settings.Defaults()), --json on list and
  get. Body sends the whole file with one key changed, so a key the
  save keeps when absent (noBird, refusalRetries, ...) is set even to
  off. A flag where a key or value goes, an unknown key (with near
  matches named) or a refused value writes nothing and exits 1;
  --help prints usage.
- Parity guards: TestKeysAreWhatTheSaveWrites (each Settings field sent
  changed on its own; what the save takes must equal Keys),
  TestSettingsCLISetsWhatTheWindowSaves (every key the page's prefsKeep
  and savePrefs send is a key), TestEveryRouteHasACommandOrIsNamed
  (each /api route has a command or a reason in notYet, which later
  stages shrink; 36 have one now).
- Item 3 of the stage (per-provider CLI-only fields in the window) is
  left for stage 2.
- The open app's in-process follow-ups (fonts, Dock, tray menu, alerts,
  language, update re-check) run only from the window's save: #4752.

Run (mote, at the pushed head 1c3591b5d + this):
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; GOOS=linux go build -tags nogui;
  GOOS=windows go build: clean (before rebase, the vets again after).
- go test internal/settingsapi, internal/settings, internal/cli: ok.
  internal/gui -run Settings|Prefs|Keep after the rebase: ok. The full
  internal/gui run before the rebase had three reds:
  TestSettingsSaveKeepsWhatItDoesNotSend (BusyLoad, fixed on main in
  b646a9127), TestColdTurnsTaken (fixed on main in 647323409) and
  TestMainWindowCorners/macOS_26_SDK (#3949, mote is macOS 27).
- Real run in a sandbox HOME on mote with a magpie built from this:
  settings --help / help, list, get, set theme dark, noBird on,
  redactWords "acme, globex", usageAlert 85; refused theme neon, `them`
  (names theme), usageAlert lots, trayUsageEvery 4, vision
  nobody/nothing, each exit 1 with settings.json unchanged; set
  usageAlert --help printed usage and wrote nothing. Then `magpie web`
  with MAGPIE_WEB_KEY: GET /api/settings read back each value the CLI
  set; POST /api/settings lang ja, then `settings get lang` said ja;
  reset theme gave system.

Broken by hand, each red, then put back: noBird dropped from Keys
(TestKeys, TestBodySetsOneKeyOnly, the CLI set test and the GUI parity
test red); Body dropping false values (TestBodySetsOneKeyOnly and the
CLI "noBird off" check red); a route taken out of notYet and another
renamed (TestEveryRouteHasACommandOrIsNamed red, 3 errors). On the old
code the new tests don't compile (no settingsapi, no command).

Not tried: a real run on Windows or Linux; the live app reacting to a
CLI write while open (#4752); the GUI node suite (no page file changed).
2026-11-01 15:57:43 +08:00