Files
magpie/docs
yetone e50a958014 gateway: an unknown model's 404 names the nearest ids, display names first, and how a model is named (MOMO on Discord)
MOMO asked for "Zen-Space-Bunny", the model's name as a picker shows
it, and the 404 said only "magpie knows no model" and then every id. It
named neither the id meant (opencode-zen-free/space-bunny-free, "Space
Bunny Free") nor the forms a model id can take.

What changed:
- provider/closest.go: Closest(asked, n) splits asked into lowercase
  letter and digit words and scores every catalog entry: a word in the
  display name (the user's or the vendor's) counts 4, in the model id 3,
  the provider's id or name 1 and only alongside one of the others; the
  whole of asked found in the name or id adds 4.
- gateway/unknown_model.go: unknownModel puts "did you mean …?" (up to
  3), then the forms (provider/model, a routing group's id or name, a
  bare model id and where an ambiguous one goes), then the ids as
  before. Used by the chat 404 and the embeddings 404. Switched-off,
  disabled-group and empty-group 404s are unchanged. Draw and video keep
  their own 404: their models are a different list, and the chat
  catalog's nearest ids would point at models that can't draw.
- docs: gateway-routing.md model resolution row.

Tests: unknown_model_test.go: "Zen-Space-Bunny" against
opencode-zen-free serving space-bunny-free named "Space Bunny Free" is
told that id first and the forms; a provider's name alone suggests
nothing; a display name ranks before an id with the same words. The
404 test fails with the gateway hooks reverted.

Run: gofmt -l; go vet -tags nogui on darwin, linux, windows for provider
and gateway; go test -tags nogui ./internal/provider ./internal/gateway
and the root package in a sandbox HOME.
2026-10-10 05:46:48 +08:00
..