Commit Graph
1 Commits
Author SHA1 Message Date
yetone 810a4144fe catalog: a model's Same as gives it that model's window, levels and images; a channel's tag in brackets is read past (pinmmis on X)
pinmmis on X (tweet 2115776439341506603): the same model from several
relays, each renamed to be told apart ("ds.4.1(WB)" for
deepseek-v4.1-flash), had none of models.dev's specs, and setting each
spec by hand per model was the only way.

The ids are the relay's own (magpie looks up the model's id, not a
display name), so this is not a display-name bug. The editor's
per-model "Same as" (settings' ModelSameAs) already merged routing
groups and priced the model; now it also gives the model that model's
window, reply limit, reasoning levels, thinking and images:

- catalog.UserSame, set by the settings package (sameas.go,
  sameAsBare: ModelSameAs indexed by bare model id, memoised per
  shared map), is asked by contextIn/lookupIn after the id as given
  and before magpie's own guesses (renamed, normalFor). An id
  models.dev lists stays its own; the user's own window, output,
  levels and images settings still win (callers read them first).
  The model named is looked up once, never sent back to UserSame (no
  loops). KnowsAsWritten (usage telemetry) never hears it.
- Zero-config part: those lookups also read past a channel's tag in
  brackets at an id's start or end (untagged: "deepseek-v4.1-flash
  (WB)", "[WB] ...", fullwidth and CJK brackets). A "[...]" written
  onto the id with no space is not a tag ("deepseek-v4.1-flash[fast]"
  may be a variant, TestRenameNeverTakesAModelForAnother). Prices are
  never borrowed this way (TestOtherSpellingIsNotPriced's rule); a
  Same as's price is still SamePriceIn.
- "ds.4.1(WB)" itself is not guessed: ds/4.1 could be flash or pro.
- GUI: the Same as box's tooltip says what it now covers, in every
  language; provider-same-as.test.cjs checks every language, not zh
  only. No layout or API change.
- docs/subsystems/providers-accounts.md says it.

Run on mote via mote-run:
- at the same change on 2c89794ac: go test -tags nogui -timeout 45m
  ./internal/catalog ./internal/settings ./internal/provider
  ./internal/agent ./internal/gateway ./internal/gui ./internal/cli:
  all ok (gateway 525s).
- at this commit (rebased on 2d11cde05, which touched provider and the
  GUI): catalog, settings, provider, gui again: all ok
- node --test provider-same-as, i18n-keys, names-fold in chromium and
  webkit, at this commit: 16 of 16 pass.
- gofmt -l clean; GOOS=linux/windows/darwin go vet -tags nogui of
  catalog, settings, provider: clean.
- Real use: magpie built in a sandbox HOME on mote with the real
  models.dev cache, a relay provider with ds.4.1(WB) (Same as
  deepseek-v4.1-flash), ds.4.1(other) and "deepseek-v4.1-flash (WB)":
  `magpie model spec` gives the first and third 1048576 / 384k /
  vision on / low,high,max, the second unknown.

Broken by hand: userSame and untagged made to find nothing ->
TestUserSameGivesTheSpecs, TestTaggedIDHasTheModelsSpecs (17 errors)
and TestSameAsGivesAnUnlistedModelItsSpecs go red.

Not tried: a real relay request in the GUI app; Windows/Linux runs
(pure Go lookups, no OS paths); the whole GUI suite (only a tooltip
string changed).
2026-10-29 20:36:04 +08:00