elis_pina (LoveEcho1145) on X: some APIs list a model more than once in
their /models, and each copy was a row of its own. A provider asked at its
base already merged copies by id (Provider.fetchOne's add), but one asked at
the URL its list is at (ModelsURL), the add form's List, and every list
fetched another way (accounts, Azure, Kilo, Cline, decision lists) kept
them, in the pickers, /v1/models and the agents' lists.
catalog.Unique keeps each id once: the first copy in its place, with what
it leaves unsaid (a name other than the id, window, output, levels, price,
APIs, tiers, magpie_via, keys) taken from the copies after it, as the
lookups by id (LiveByID's callers) already took the first copy that said
it. It runs at the parse of every upstream /models (catalog.fetchOne, all
pages), at every save (saveLive: the list and each base's part, whoever
fetched it), and at every read (readLive), so a list saved before reads
each id once without waiting for a fetch. A list with no copies comes back
as it is. Plugins' lists are keyed by id in host.js already. Keyed by id
alone, as Provider.fetchOne and fetchPerKey merge already.
Tests: TestFetchedListNamesEachModelOnce, TestSavedListNamesEachModelOnce
(saved, sides, LiveByID, and a file written before with copies),
TestUniqueLeavesAListWithoutCopies, TestProviderListsEachModelOnce (at
base and at ModelsURL: Fetch, List, Available). Broken by hand: with
Unique returning its input, the first two and the ModelsURL case of the
last are red (Fetch/List/Available listed [gpt-5.6 glm-5.3 gpt-5.6
glm-5.3]); with readLive's Unique alone taken out, the saved-before case
is red.
Run on mica: gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags
nogui ./... ok; go test -timeout 45m ./... at b552edb12 (base 6af327e2b):
100 packages ok, internal/plugin red on TestCancelledSignInSavesNothing,
#5532 (filed, same tok-late output, passes -count=10 alone at this head).
Rebased on 87a0af212 (changes only gateway test files and LESSONS
since); at the pushed head internal/catalog and
internal/provider ok, linux/windows vet of both ok. No GUI file changed
and no API shape changed, so no GUI suite was run. Not tried: a real
vendor that lists copies (the reporter named none).