provider: a catalog entry points at its provider instead of copying it
Entry.Provider was a Provider value, 1,328 of an Entry's 1,760 bytes, copied into every model of every provider each time a catalog, an agent's list or a routing group's entries were built. It is now a *Provider: entriesOf and decide's list give every model of one provider the same one (sharedEntry), and a group's entry points at its first member's. It is read only; every place that hands it on as a value (Resolve, CanFast, ownAgent, modelAllowed, …) dereferences it, so what they get is a copy as before. entryFor keeps its signature for the one model ServedEntryOf builds; offEntries' entries now carry their provider too. Measured on mote with the owner's real accounts (acctp sandbox, page open for 2m32s, w40 = before, w41 = this, alternating): - catalogOf's allocations 106 MB -> 67 MB, providerEntries' 88 -> 78 MB - CPU at the page's settle mark 3.42/3.33 s -> 3.18/3.30 s - live heap unchanged (76.3/76.1 -> 76.7/75.9 MB): the lists are rebuilt, not kept, so the copies were churn for the GC, not held Run: go build and go vet ./... and the tests compiled (go test -run ^$) on mote; the full suite at this tree (d1e823d5f) on mica: 99 packages ok, 0 FAIL (agent 317s, gateway 972s, gui 188s, provider 220s, usage 56s).
This commit is contained in:
@@ -360,7 +360,7 @@ func claudeReviewed(catalogs []string, models ...string) bool {
|
||||
find := provider.GroupFinder()
|
||||
for _, e := range entries {
|
||||
if e.Group == "" {
|
||||
if !answered(e.Provider, e.Model) {
|
||||
if !answered(*e.Provider, e.Model) {
|
||||
return false
|
||||
}
|
||||
continue
|
||||
|
||||
@@ -158,7 +158,7 @@ func buildVia(agent, prefix string) []Option {
|
||||
}
|
||||
note := e.Provider.Name + " · via magpie"
|
||||
if a := e.Provider.Account; a != nil {
|
||||
note = firstUser(e.Provider) + " · via magpie"
|
||||
note = firstUser(*e.Provider) + " · via magpie"
|
||||
}
|
||||
o := Option{Value: prefix + e.ID, Label: e.Name, Note: note,
|
||||
Icon: e.Provider.Icon, Group: e.Provider.Name, Ref: e.ID, Free: e.Free, Rate: e.Rate, RateWas: e.RateWas, Context: e.Context, own: own[e.Provider.ID],
|
||||
@@ -167,13 +167,13 @@ func buildVia(agent, prefix string) []Option {
|
||||
o.Zero = e.Provider.PricedFree(set, e.Model)
|
||||
}
|
||||
// a model with a fast mode is switched fast in the picker (#954)
|
||||
if provider.CanFast(e.Provider, e.Model) {
|
||||
if provider.CanFast(*e.Provider, e.Model) {
|
||||
o.FastFor, o.Fast = agent, slices.Contains(fast, e.ID)
|
||||
o.OwnFast = provider.OwnFast(e.Provider, e.Model)
|
||||
o.OwnFast = provider.OwnFast(*e.Provider, e.Model)
|
||||
if tiered == nil {
|
||||
tiered = provider.UltraModels()
|
||||
}
|
||||
if provider.UltraOn(e.Provider, e.Model, tiered) {
|
||||
if provider.UltraOn(*e.Provider, e.Model, tiered) {
|
||||
o.UltraOK, o.Ultra = true, o.Fast && slices.Contains(ultra, e.ID)
|
||||
}
|
||||
}
|
||||
@@ -449,7 +449,7 @@ func buildModels(agent string) []catalog.Model {
|
||||
// OpenCode has no command for and takes as variants (#2379); a
|
||||
// group is sent fast as the group says, as a fast pick is
|
||||
if a := e.Provider.Account; e.Group == "" && a != nil && a.Agent == "codex" {
|
||||
m.CodexFast = provider.CanFast(e.Provider, e.Model)
|
||||
m.CodexFast = provider.CanFast(*e.Provider, e.Model)
|
||||
}
|
||||
m.Efforts, m.Keys, m.APIs, m.Endpoints = slices.Clip(m.Efforts), slices.Clip(m.Keys), slices.Clip(m.APIs), slices.Clip(m.Endpoints)
|
||||
m.InputModalities, m.OutputModalities, m.Tiers, m.Codex = slices.Clip(m.InputModalities), slices.Clip(m.OutputModalities), slices.Clip(m.Tiers), slices.Clip(m.Codex)
|
||||
|
||||
@@ -290,11 +290,11 @@ func TestDesktopKnowsMythos(t *testing.T) {
|
||||
func TestDesktopNames(t *testing.T) {
|
||||
fresh(t)
|
||||
es := []provider.Entry{
|
||||
{ID: "a/x", Name: "X", Provider: provider.Provider{ID: "a", Name: "A"}},
|
||||
{ID: "b/x", Name: "x", Provider: provider.Provider{ID: "b", Name: "B"}},
|
||||
{ID: "c/y", Name: "Y", Provider: provider.Provider{ID: "c", Name: "C"}},
|
||||
{ID: "d/z", Name: "Z", Provider: provider.Provider{ID: "d", Name: "D"}},
|
||||
{ID: "d/z2", Name: "Z", Provider: provider.Provider{ID: "d", Name: "D"}},
|
||||
{ID: "a/x", Name: "X", Provider: &provider.Provider{ID: "a", Name: "A"}},
|
||||
{ID: "b/x", Name: "x", Provider: &provider.Provider{ID: "b", Name: "B"}},
|
||||
{ID: "c/y", Name: "Y", Provider: &provider.Provider{ID: "c", Name: "C"}},
|
||||
{ID: "d/z", Name: "Z", Provider: &provider.Provider{ID: "d", Name: "D"}},
|
||||
{ID: "d/z2", Name: "Z", Provider: &provider.Provider{ID: "d", Name: "D"}},
|
||||
}
|
||||
if got, want := desktopNames("claude-desktop", es), []string{"X · A", "x · B", "Y · C", "Z · D (d/z)", "Z · D (d/z2)"}; !slices.Equal(got, want) {
|
||||
t.Fatalf("desktopNames = %q, want %q", got, want)
|
||||
|
||||
@@ -92,7 +92,7 @@ func (s *Server) dshCompactElsewhere(r *http.Request, agent, kind, asked string,
|
||||
if e.Group != "" || e.Provider.ID == p.ID || e.Context <= window || provider.AutoGroupOf(e.Provider.ID, e.Model) != key {
|
||||
continue
|
||||
}
|
||||
if compactRefused(r, e.ID) != "" || s.allResting(e.Provider, e.Model, from) {
|
||||
if compactRefused(r, e.ID) != "" || s.allResting(*e.Provider, e.Model, from) {
|
||||
continue
|
||||
}
|
||||
best, window = e.ID, e.Context
|
||||
|
||||
@@ -273,7 +273,7 @@ func TestGatewayKeyKeptOutQuotaCards(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
who := access.Identity{KeyID: "k", Quotas: true, Accounts: []string{"relay/!" + provider.KeyID("kB")}}
|
||||
s := newQuotaScope(who, []provider.Entry{{Provider: provider.Provider{ID: "relay"}, Model: "m"}})
|
||||
s := newQuotaScope(who, []provider.Entry{{Provider: &provider.Provider{ID: "relay"}, Model: "m"}})
|
||||
if !s.provider("relay") {
|
||||
t.Fatal("the provider's quota is the key's")
|
||||
}
|
||||
|
||||
@@ -418,10 +418,10 @@ func (k *keyList) entryAllowed(e provider.Entry) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
if !modelAllowed(who, e.Provider, e.Model) {
|
||||
if !modelAllowed(who, *e.Provider, e.Model) {
|
||||
return false
|
||||
}
|
||||
return k.accountServes(e.Provider, e.Model)
|
||||
return k.accountServes(*e.Provider, e.Model)
|
||||
}
|
||||
|
||||
// accountServes is accountServes with p's accounts and keys read once
|
||||
@@ -529,7 +529,7 @@ func keyListed(r *http.Request, shown []provider.Entry, off func(string) bool) [
|
||||
shown = slices.Clone(shown)
|
||||
for _, s := range ins {
|
||||
e := s.Entry
|
||||
if in[e.ID] || off != nil && off(e.ID) || held && !modelAllowed(who, e.Provider, e.Model) || slices.ContainsFunc(s.Groups, given) {
|
||||
if in[e.ID] || off != nil && off(e.ID) || held && !modelAllowed(who, *e.Provider, e.Model) || slices.ContainsFunc(s.Groups, given) {
|
||||
continue
|
||||
}
|
||||
// beside its provider's other models, where it would be
|
||||
|
||||
@@ -27,7 +27,7 @@ func listedBefore(who access.Identity, es []provider.Entry) []string {
|
||||
ok = slices.ContainsFunc(ms, func(m provider.Member) bool { return accountServes(who, m.Provider, m.Model) })
|
||||
}
|
||||
} else if !ok {
|
||||
ok = modelAllowed(who, e.Provider, e.Model) && accountServes(who, e.Provider, e.Model)
|
||||
ok = modelAllowed(who, *e.Provider, e.Model) && accountServes(who, *e.Provider, e.Model)
|
||||
}
|
||||
if ok {
|
||||
out = append(out, e.ID)
|
||||
|
||||
@@ -134,7 +134,7 @@ func TestOtherRelayKeepsItsOneAPI(t *testing.T) {
|
||||
if apis := p.APIs("gpt-6-luna"); apis != nil {
|
||||
t.Errorf("relay gpt-6-luna APIs %v, want none named", apis)
|
||||
}
|
||||
if got := provider.NativeEndpoints(provider.Entry{Provider: *p, Model: "gpt-6-luna", ID: "relay/gpt-6-luna"}); len(got) != 1 || got[0] != "/v1/chat/completions" {
|
||||
if got := provider.NativeEndpoints(provider.Entry{Provider: p, Model: "gpt-6-luna", ID: "relay/gpt-6-luna"}); len(got) != 1 || got[0] != "/v1/chat/completions" {
|
||||
t.Errorf("relay native_endpoints %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func newQuotaScope(who access.Identity, catalog []provider.Entry) *quotaScope {
|
||||
if seen && !ok {
|
||||
continue
|
||||
}
|
||||
s.every[id] = modelAllowed(who, e.Provider, e.Model)
|
||||
s.every[id] = modelAllowed(who, *e.Provider, e.Model)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestSearchProviderOffTellsRemoteMagpie(t *testing.T) {
|
||||
if err := provider.Save(p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
e := provider.Entry{Provider: p, Model: "kimi-for-coding"}
|
||||
e := provider.Entry{Provider: &p, Model: "kimi-for-coding"}
|
||||
if got := webSearchOf(e, canSearch()); got != searchMagpie {
|
||||
t.Fatalf("automatic: %q, want %q", got, searchMagpie)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func searchableModel(p provider.Provider, model string) bool {
|
||||
// webSearchOf is what this magpie's list tells another magpie of how it
|
||||
// searches for e (remoteSearch): magpie is whether it has a searcher.
|
||||
func webSearchOf(e provider.Entry, magpie bool) string {
|
||||
p := e.Provider
|
||||
p := *e.Provider
|
||||
if e.Group == "" {
|
||||
if p.IsRemoteMagpie() && remoteSearch(p, e.Model) == searchNative || codeAssistSearches(p, provider.CodeAssist, e.Model) {
|
||||
return searchNative
|
||||
|
||||
@@ -239,7 +239,7 @@ type modelRef struct {
|
||||
|
||||
// servedRef is a served model as the Routing page lists it
|
||||
func servedRef(e provider.Entry, s settings.Settings) modelRef {
|
||||
return modelRef{Free: e.Free, Zero: !e.Free && e.Provider.PricedFree(s, e.Model), ID: e.ID, Name: e.Name, Provider: e.Provider.ID, PName: e.Provider.Name, Icon: e.Provider.Icon, Context: e.Context, Efforts: e.Efforts, CanFast: provider.CanFast(e.Provider, e.Model), OwnFast: provider.OwnFast(e.Provider, e.Model), Images: seesImages(e), ImagesUnknown: imagesUnknown(e), Sub: e.Provider.Account != nil}
|
||||
return modelRef{Free: e.Free, Zero: !e.Free && e.Provider.PricedFree(s, e.Model), ID: e.ID, Name: e.Name, Provider: e.Provider.ID, PName: e.Provider.Name, Icon: e.Provider.Icon, Context: e.Context, Efforts: e.Efforts, CanFast: provider.CanFast(*e.Provider, e.Model), OwnFast: provider.OwnFast(*e.Provider, e.Model), Images: seesImages(e), ImagesUnknown: imagesUnknown(e), Sub: e.Provider.Account != nil}
|
||||
}
|
||||
|
||||
type poolJSON struct {
|
||||
@@ -386,7 +386,7 @@ func groupsState() groupsJSON {
|
||||
if e.Group == "" {
|
||||
chat[e.ID] = true
|
||||
ref := servedRef(e, set)
|
||||
ref.UltraOK = ref.CanFast && provider.UltraOn(e.Provider, e.Model, ultra())
|
||||
ref.UltraOK = ref.CanFast && provider.UltraOn(*e.Provider, e.Model, ultra())
|
||||
out.Models = append(out.Models, ref)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ import (
|
||||
// request to that subscription; a key's model says nothing of it.
|
||||
func TestServedRefSaysASubscription(t *testing.T) {
|
||||
sub := servedRef(provider.Entry{ID: "codex/gpt-5-mini", Name: "gpt-5-mini", Model: "gpt-5-mini",
|
||||
Provider: provider.Provider{ID: "codex", Name: "Codex", Account: &provider.Account{Agent: "codex", User: "a@x.y"}}}, settings.Settings{})
|
||||
Provider: &provider.Provider{ID: "codex", Name: "Codex", Account: &provider.Account{Agent: "codex", User: "a@x.y"}}}, settings.Settings{})
|
||||
if !sub.Sub {
|
||||
t.Fatalf("a subscription's model: %+v", sub)
|
||||
}
|
||||
key := servedRef(provider.Entry{ID: "or/flash", Name: "flash", Model: "flash", Provider: provider.Provider{ID: "or", Name: "OpenRouter", Key: "k"}}, settings.Settings{})
|
||||
key := servedRef(provider.Entry{ID: "or/flash", Name: "flash", Model: "flash", Provider: &provider.Provider{ID: "or", Name: "OpenRouter", Key: "k"}}, settings.Settings{})
|
||||
if key.Sub {
|
||||
t.Fatalf("a key's model: %+v", key)
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ func offEntries() []Entry {
|
||||
continue
|
||||
}
|
||||
for _, m := range p.Exposed() {
|
||||
out = append(out, Entry{ID: p.ID + "/" + m.ID})
|
||||
out = append(out, Entry{ID: p.ID + "/" + m.ID, Provider: &p})
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -19,11 +19,11 @@ func TestCodexPickerNamesSameNamesApart(t *testing.T) {
|
||||
b := Provider{ID: "codex-b", Name: "Codex", Account: &Account{Agent: "codex", User: "b@example.com"}}
|
||||
r := Provider{ID: "relay", Name: "Relay"}
|
||||
ms := codexListed([]Entry{
|
||||
{ID: "codex/gpt-6.1-sol", Model: "gpt-6.1-sol", Name: "GPT-6.1-Sol", Provider: a},
|
||||
{ID: "codex-b/gpt-6.1-sol", Model: "gpt-6.1-sol", Name: "GPT-6.1-Sol", Provider: b},
|
||||
{ID: "relay/glm-5.3", Model: "glm-5.3", Name: "GLM-5.3", Provider: r},
|
||||
{ID: "relay/glm-5.3-old", Model: "glm-5.3-old", Name: "GLM-5.3", Provider: r},
|
||||
{ID: "relay/kimi-k3", Model: "kimi-k3", Name: "Kimi K3", Provider: r},
|
||||
{ID: "codex/gpt-6.1-sol", Model: "gpt-6.1-sol", Name: "GPT-6.1-Sol", Provider: &a},
|
||||
{ID: "codex-b/gpt-6.1-sol", Model: "gpt-6.1-sol", Name: "GPT-6.1-Sol", Provider: &b},
|
||||
{ID: "relay/glm-5.3", Model: "glm-5.3", Name: "GLM-5.3", Provider: &r},
|
||||
{ID: "relay/glm-5.3-old", Model: "glm-5.3-old", Name: "GLM-5.3", Provider: &r},
|
||||
{ID: "relay/kimi-k3", Model: "kimi-k3", Name: "Kimi K3", Provider: &r},
|
||||
}, func(string) []Member { return nil }, true)
|
||||
type shown struct{ name, desc string }
|
||||
want := []shown{
|
||||
|
||||
@@ -1053,7 +1053,7 @@ func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
}
|
||||
// so is a model of its own that has one, which no tier above names
|
||||
// (an Anthropic key's Opus, an OpenAI key's GPT, a Cursor account's)
|
||||
if len(m.Tiers) == 0 && CanFast(e.Provider, e.Model) {
|
||||
if len(m.Tiers) == 0 && CanFast(*e.Provider, e.Model) {
|
||||
m.Tiers = []string{codexFastTier}
|
||||
}
|
||||
}
|
||||
@@ -1065,7 +1065,7 @@ func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
// none.
|
||||
func CodexSeals(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
if e.Group == "" {
|
||||
m.Seals = maySeal(e.Provider)
|
||||
m.Seals = maySeal(*e.Provider)
|
||||
return
|
||||
}
|
||||
for _, mb := range members(e.ID) {
|
||||
|
||||
@@ -23,9 +23,9 @@ func TestCodexSeals(t *testing.T) {
|
||||
e Entry
|
||||
want bool
|
||||
}{
|
||||
{Entry{ID: "relay/gpt-6-astra", Provider: relay, Model: "gpt-6-astra"}, true},
|
||||
{Entry{ID: "ds/deepseek-v4", Provider: chat, Model: "deepseek-v4"}, false},
|
||||
{Entry{ID: "copilot/gpt-6.1-sol", Provider: copilot, Model: "gpt-6.1-sol"}, false},
|
||||
{Entry{ID: "relay/gpt-6-astra", Provider: &relay, Model: "gpt-6-astra"}, true},
|
||||
{Entry{ID: "ds/deepseek-v4", Provider: &chat, Model: "deepseek-v4"}, false},
|
||||
{Entry{ID: "copilot/gpt-6.1-sol", Provider: &copilot, Model: "gpt-6.1-sol"}, false},
|
||||
{Entry{ID: "group/mixed", Group: "mixed"}, true},
|
||||
{Entry{ID: "group/plain", Group: "plain"}, false},
|
||||
} {
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestCodexOffersLevelsForUnknownModels(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
shown, _ := CatalogFor("codex")
|
||||
shown = append(shown, Entry{ID: "group/mix", Model: "group/mix", Name: "mix", Group: "mix", Provider: Provider{ID: "xjai"}})
|
||||
shown = append(shown, Entry{ID: "group/mix", Model: "group/mix", Name: "mix", Group: "mix", Provider: &Provider{ID: "xjai"}})
|
||||
levels := map[string][]string{}
|
||||
for _, m := range CodexCatalog(shown) {
|
||||
levels[m.ID] = m.Efforts
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestContextSetByUser(t *testing.T) {
|
||||
}
|
||||
|
||||
e := func(p, m string, ctx int) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: Provider{ID: p}, Context: ctx}
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: &Provider{ID: p}, Context: ctx}
|
||||
}
|
||||
entries := []Entry{e("a", "m1", 128000), e("b", "m2", 200000)}
|
||||
of := func() int {
|
||||
@@ -85,7 +85,7 @@ func TestGroupToldItsLargestWindow(t *testing.T) {
|
||||
t.Setenv("USERPROFILE", home)
|
||||
t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, ".config"))
|
||||
e := func(p, m string, ctx int) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: Provider{ID: p}, Context: ctx}
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: &Provider{ID: p}, Context: ctx}
|
||||
}
|
||||
entries := []Entry{
|
||||
e("workbuddy-ai", "deepseek-v4.1-flash", 1000000),
|
||||
|
||||
@@ -712,9 +712,9 @@ func deciders(keep func(id string) bool) []Entry {
|
||||
for _, m := range ms {
|
||||
if p.isDecision(m) && !off(p.ID, m.ID) { // a disabled one isn't offered (#1867)
|
||||
if p.IsRemoteMagpie() {
|
||||
out = append(out, entryFor(p, m, s))
|
||||
out = append(out, sharedEntry(&p, m, s))
|
||||
} else {
|
||||
out = append(out, Entry{ID: p.ID + "/" + m.ID, Model: m.ID, Name: m.Name, Provider: p})
|
||||
out = append(out, Entry{ID: p.ID + "/" + m.ID, Model: m.ID, Name: m.Name, Provider: &p})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ func AutoStandInFor(agent, id string) (string, bool) {
|
||||
if AutoGroupOf(e.Provider.ID, e.Model) != gid {
|
||||
continue
|
||||
}
|
||||
if ownAgent(e.Provider, agent) {
|
||||
if ownAgent(*e.Provider, agent) {
|
||||
return e.ID, true
|
||||
}
|
||||
if kept == "" && !slices.Contains(f.AutoGroupSkip, e.Provider.ID) {
|
||||
@@ -1505,7 +1505,7 @@ func buildGroupEntries(entries []Entry) []Entry {
|
||||
if len(ms) == 0 || DecisionGroup(ms) {
|
||||
continue // a decision group answers System One, no agent's conversation
|
||||
}
|
||||
e := Entry{ID: g.Ref(), Model: ms[0].Model, Name: g.Name, Provider: ms[0].Provider, Group: g.ID, Named: !g.Auto}
|
||||
e := Entry{ID: g.Ref(), Model: ms[0].Model, Name: g.Name, Provider: &ms[0].Provider, Group: g.ID, Named: !g.Auto}
|
||||
var fixed []string // the efforts members are fixed at
|
||||
levelled := false // a member that follows the agent's effort was met
|
||||
// Codex's ultra (max, with Codex handing parts of the task to agents
|
||||
|
||||
@@ -227,7 +227,7 @@ func thinksMember() Entry { return thinks("a", levels) }
|
||||
// thinks is a model that does: its own levels as given. Same model id as
|
||||
// quietMember's, so the two are members of one group.
|
||||
func thinks(p string, efforts []string) Entry {
|
||||
return Entry{ID: p + "/m", Model: "m", Name: "m", Provider: Provider{ID: p}, Efforts: efforts, Reasoning: true}
|
||||
return Entry{ID: p + "/m", Model: "m", Name: "m", Provider: &Provider{ID: p}, Efforts: efforts, Reasoning: true}
|
||||
}
|
||||
|
||||
// quietMember is a member that doesn't think, and has no levels of its own:
|
||||
@@ -243,7 +243,7 @@ func quietMember() Entry {
|
||||
// quiet is a model that doesn't think: its provider gives no levels for it,
|
||||
// and nothing says it reasons.
|
||||
func quiet(p string) Entry {
|
||||
return Entry{ID: p + "/m", Model: "m", Name: "m", Provider: Provider{ID: p}}
|
||||
return Entry{ID: p + "/m", Model: "m", Name: "m", Provider: &Provider{ID: p}}
|
||||
}
|
||||
|
||||
// groupReasoningHome is a machine of its own with a provider whose model
|
||||
|
||||
@@ -20,8 +20,8 @@ func TestOwnGroupsWaitOnThePlugin(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
entries := []Entry{
|
||||
{ID: "a/x", Model: "x", Provider: Provider{ID: "a"}}, {ID: "b/y", Model: "y", Provider: Provider{ID: "b"}},
|
||||
{ID: "a/m", Model: "m", Provider: Provider{ID: "a"}}, {ID: "b/m", Model: "m", Provider: Provider{ID: "b"}},
|
||||
{ID: "a/x", Model: "x", Provider: &Provider{ID: "a"}}, {ID: "b/y", Model: "y", Provider: &Provider{ID: "b"}},
|
||||
{ID: "a/m", Model: "m", Provider: &Provider{ID: "a"}}, {ID: "b/m", Model: "m", Provider: &Provider{ID: "b"}},
|
||||
}
|
||||
listed := func() []string {
|
||||
var ids []string
|
||||
@@ -81,7 +81,7 @@ func TestOwnGroupRefreshesTheGate(t *testing.T) {
|
||||
t.Setenv("HOME", home)
|
||||
t.Setenv("USERPROFILE", home)
|
||||
t.Setenv("XDG_CONFIG_HOME", "")
|
||||
entries := []Entry{{ID: "a/m", Model: "m", Provider: Provider{ID: "a"}}, {ID: "b/m", Model: "m", Provider: Provider{ID: "b"}}}
|
||||
entries := []Entry{{ID: "a/m", Model: "m", Provider: &Provider{ID: "a"}}, {ID: "b/m", Model: "m", Provider: &Provider{ID: "b"}}}
|
||||
asked := 0
|
||||
var remove func()
|
||||
defer func() {
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestAutoGroupsSameModel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
e := func(p, m, name string) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: name, Provider: Provider{ID: p}}
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: name, Provider: &Provider{ID: p}}
|
||||
}
|
||||
gs := autoGroups([]Entry{
|
||||
e("openrouter", "anthropic/claude-opus-5.5", "anthropic/claude-opus-5.5"),
|
||||
@@ -45,7 +45,7 @@ func TestGroupImages(t *testing.T) {
|
||||
t.Setenv("XDG_CONFIG_HOME", "")
|
||||
no, yes := false, true
|
||||
e := func(p, m string, images bool, in *bool) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: Provider{ID: p}, Images: images, ImageInput: in}
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: &Provider{ID: p}, Images: images, ImageInput: in}
|
||||
}
|
||||
gs := groupEntries([]Entry{
|
||||
e("a", "kimi-k3", true, nil), e("b", "kimi-k3", true, nil),
|
||||
@@ -72,8 +72,8 @@ func TestGroupImagesFromAMemberThatSees(t *testing.T) {
|
||||
t.Setenv("XDG_CONFIG_HOME", "")
|
||||
yes := true
|
||||
entries := []Entry{
|
||||
{ID: "a/m", Model: "m", Provider: Provider{ID: "a"}, Images: true, ImageInput: &yes},
|
||||
{ID: "b/m", Model: "m", Provider: Provider{ID: "b"}, Images: true},
|
||||
{ID: "a/m", Model: "m", Provider: &Provider{ID: "a"}, Images: true, ImageInput: &yes},
|
||||
{ID: "b/m", Model: "m", Provider: &Provider{ID: "b"}, Images: true},
|
||||
}
|
||||
groups := groupEntries(entries)
|
||||
if len(groups) != 1 || !groups[0].Images || groups[0].ImageInput == nil || !*groups[0].ImageInput {
|
||||
@@ -88,10 +88,10 @@ func TestGroupInputsAreItsMembers(t *testing.T) {
|
||||
t.Setenv("USERPROFILE", t.TempDir())
|
||||
t.Setenv("XDG_CONFIG_HOME", "")
|
||||
entries := []Entry{
|
||||
{ID: "a/m", Model: "m", Provider: Provider{ID: "a"}, Images: true, Inputs: []string{"text", "image"}, Outputs: []string{"text"}},
|
||||
{ID: "b/m", Model: "m", Provider: Provider{ID: "b"}, Images: true, Inputs: []string{"text", "image", "video"}, Outputs: []string{"text"}},
|
||||
{ID: "a/n", Model: "n", Provider: Provider{ID: "a"}},
|
||||
{ID: "b/n", Model: "n", Provider: Provider{ID: "b"}},
|
||||
{ID: "a/m", Model: "m", Provider: &Provider{ID: "a"}, Images: true, Inputs: []string{"text", "image"}, Outputs: []string{"text"}},
|
||||
{ID: "b/m", Model: "m", Provider: &Provider{ID: "b"}, Images: true, Inputs: []string{"text", "image", "video"}, Outputs: []string{"text"}},
|
||||
{ID: "a/n", Model: "n", Provider: &Provider{ID: "a"}},
|
||||
{ID: "b/n", Model: "n", Provider: &Provider{ID: "b"}},
|
||||
}
|
||||
got := map[string]Entry{}
|
||||
for _, g := range groupEntries(entries) {
|
||||
@@ -110,9 +110,9 @@ func TestGroupInputsAreItsMembers(t *testing.T) {
|
||||
func TestCodexListedKeepsGroups(t *testing.T) {
|
||||
acct := Provider{ID: "codex-me", Account: &Account{Agent: "codex"}}
|
||||
ms := codexListed([]Entry{
|
||||
{ID: GroupPrefix + "fast", Model: "gpt-5.5", Name: "fast", Provider: acct, Group: "fast"},
|
||||
{ID: "codex-me/gpt-5.5", Model: "gpt-5.5", Provider: acct},
|
||||
{ID: "or/glm-5.3", Model: "glm-5.3", Provider: Provider{ID: "or"}},
|
||||
{ID: GroupPrefix + "fast", Model: "gpt-5.5", Name: "fast", Provider: &acct, Group: "fast"},
|
||||
{ID: "codex-me/gpt-5.5", Model: "gpt-5.5", Provider: &acct},
|
||||
{ID: "or/glm-5.3", Model: "glm-5.3", Provider: &Provider{ID: "or"}},
|
||||
}, func(id string) []Member {
|
||||
return []Member{{Provider: Provider{ID: "or"}, Model: "glm-5.3"}, {Provider: acct, Model: "gpt-5.5"}}
|
||||
}, false)
|
||||
@@ -139,7 +139,7 @@ func TestGroupSharesKimiFacts(t *testing.T) {
|
||||
t.Setenv("USERPROFILE", t.TempDir())
|
||||
t.Setenv("XDG_CONFIG_HOME", "")
|
||||
e := func(p, m string, always, dynamic bool, def string) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: Provider{ID: p}, Reasoning: true,
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: &Provider{ID: p}, Reasoning: true,
|
||||
Efforts: []string{"low", "medium", "high"}, AlwaysThinks: always, DynamicTools: dynamic, DefaultEffort: def}
|
||||
}
|
||||
type facts struct {
|
||||
@@ -170,7 +170,7 @@ func TestGroupSharesKimiFacts(t *testing.T) {
|
||||
// AI's other models, are unchanged.
|
||||
func TestAutoGroupsEditionTwins(t *testing.T) {
|
||||
e := func(p, m string) Entry {
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: "DeepSeek-V4.1-Flash", Provider: Provider{ID: p}}
|
||||
return Entry{ID: p + "/" + m, Model: m, Name: "DeepSeek-V4.1-Flash", Provider: &Provider{ID: p}}
|
||||
}
|
||||
gs := autoGroups([]Entry{e("workbuddy", "deepseek-v4.1-flash"), e("workbuddy-ai", "deepseek-v4.1-flash-sg")}, nil)
|
||||
if len(gs) != 1 || gs[0].ID != "auto-deepseek-v4-1-flash" || len(gs[0].Members) != 2 {
|
||||
|
||||
@@ -111,9 +111,9 @@ func TestThenUsesLeavesOutTheRulesOwn(t *testing.T) {
|
||||
func TestRuledEntrySeveralModels(t *testing.T) {
|
||||
no, yes := false, true
|
||||
entries := []Entry{
|
||||
{ID: "a/text", Model: "text", Provider: Provider{ID: "a"}, Context: 128000, ImageInput: &no},
|
||||
{ID: "a/vision", Model: "vision", Provider: Provider{ID: "a"}, Context: 200000, Images: true, ImageInput: &yes},
|
||||
{ID: "b/vision", Model: "vision", Provider: Provider{ID: "b"}, Context: 400000, Images: true, ImageInput: &yes},
|
||||
{ID: "a/text", Model: "text", Provider: &Provider{ID: "a"}, Context: 128000, ImageInput: &no},
|
||||
{ID: "a/vision", Model: "vision", Provider: &Provider{ID: "a"}, Context: 200000, Images: true, ImageInput: &yes},
|
||||
{ID: "b/vision", Model: "vision", Provider: &Provider{ID: "b"}, Context: 400000, Images: true, ImageInput: &yes},
|
||||
}
|
||||
run := func(members []string, rules []Rule) Entry {
|
||||
var ms []Member
|
||||
|
||||
@@ -168,10 +168,10 @@ func TestRuleConditions(t *testing.T) {
|
||||
func TestRuledEntry(t *testing.T) {
|
||||
no, yes := false, true
|
||||
entries := []Entry{
|
||||
{ID: "a/text", Model: "text", Provider: Provider{ID: "a"}, Context: 128000, ImageInput: &no},
|
||||
{ID: "a/vision", Model: "vision", Provider: Provider{ID: "a"}, Context: 200000, Images: true, ImageInput: &yes},
|
||||
{ID: "b/huge", Model: "huge", Provider: Provider{ID: "b"}, Context: 1000000},
|
||||
{ID: "b/small", Model: "small", Provider: Provider{ID: "b"}, Context: 32000},
|
||||
{ID: "a/text", Model: "text", Provider: &Provider{ID: "a"}, Context: 128000, ImageInput: &no},
|
||||
{ID: "a/vision", Model: "vision", Provider: &Provider{ID: "a"}, Context: 200000, Images: true, ImageInput: &yes},
|
||||
{ID: "b/huge", Model: "huge", Provider: &Provider{ID: "b"}, Context: 1000000},
|
||||
{ID: "b/small", Model: "small", Provider: &Provider{ID: "b"}, Context: 32000},
|
||||
}
|
||||
member := func(id string) Member {
|
||||
p, m, _ := strings.Cut(id, "/")
|
||||
|
||||
@@ -147,7 +147,7 @@ func templateModels() []rated {
|
||||
r := rated{e: e}
|
||||
if pr, ok := MakerPrice(e.Model); ok {
|
||||
r.out, r.maker = pr.Output, true
|
||||
} else if pr, ok := priceOf(s, e.Provider, true, e.Model, time.Time{}); ok {
|
||||
} else if pr, ok := priceOf(s, *e.Provider, true, e.Model, time.Time{}); ok {
|
||||
// without a rate window's rate (#2463): a template weighs how
|
||||
// strong a model is, which the hour it is made in doesn't change
|
||||
r.out = pr.Output
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// tm is a model a template may be made of, as templateModels rates it.
|
||||
func tm(pid, model string, out float64, maker bool, released string) rated {
|
||||
r := rated{e: Entry{ID: pid + "/" + model, Model: model, Provider: Provider{ID: pid, Name: pid}, Released: released}, out: out, maker: maker}
|
||||
r := rated{e: Entry{ID: pid + "/" + model, Model: model, Provider: &Provider{ID: pid, Name: pid}, Released: released}, out: out, maker: maker}
|
||||
r.small, r.tiny = sizeOf(model)
|
||||
return r
|
||||
}
|
||||
|
||||
+20
-14
@@ -3188,14 +3188,14 @@ type Entry struct {
|
||||
Plain string `json:"-"`
|
||||
// By is the provider a remote magpie's list names as serving the
|
||||
// model there, the first in a chain of magpies (catalog.Model's)
|
||||
By string `json:"-"`
|
||||
Efforts []string `json:"efforts,omitempty"`
|
||||
Provider Provider `json:"-"` // a group's: its first member's
|
||||
Group string `json:"group,omitempty"` // set on a routing group (group.go)
|
||||
Named bool `json:"-"` // a routing group the user made or changed: its name is theirs (Labels)
|
||||
Icons []string `json:"-"` // a group's: its providers' icons, one per provider
|
||||
Images bool `json:"images,omitempty"` // takes images as input (a group's: a member does)
|
||||
ImageInput *bool `json:"-"` // explicit answer, nil when unknown
|
||||
By string `json:"-"`
|
||||
Efforts []string `json:"efforts,omitempty"`
|
||||
Provider *Provider `json:"-"` // a group's: its first member's; shared, read only
|
||||
Group string `json:"group,omitempty"` // set on a routing group (group.go)
|
||||
Named bool `json:"-"` // a routing group the user made or changed: its name is theirs (Labels)
|
||||
Icons []string `json:"-"` // a group's: its providers' icons, one per provider
|
||||
Images bool `json:"images,omitempty"` // takes images as input (a group's: a member does)
|
||||
ImageInput *bool `json:"-"` // explicit answer, nil when unknown
|
||||
// Inputs and Outputs are what the model's source listed it takes and
|
||||
// gives (catalog.Model's InputModalities, OutputModalities); see
|
||||
// Modalities
|
||||
@@ -3498,7 +3498,7 @@ func entriesOf(of func(Provider) bool, off func(pid, model string) bool) []Entry
|
||||
continue
|
||||
}
|
||||
if !p.isDecision(m) && !gone[p.ID+"/"+m.ID] {
|
||||
out = append(out, entryFor(p, m, s))
|
||||
out = append(out, sharedEntry(&p, m, s))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3509,6 +3509,12 @@ func entriesOf(of func(Provider) bool, off func(pid, model string) bool) []Entry
|
||||
// window and the reply limit a request on it is routed and metered against,
|
||||
// with what the user set taken over the vendor's list and models.dev.
|
||||
func entryFor(p Provider, m catalog.Model, s settings.Settings) Entry {
|
||||
return sharedEntry(&p, m, s)
|
||||
}
|
||||
|
||||
// sharedEntry is entryFor that keeps p itself in the entry, so every model of
|
||||
// one provider shares one Provider (1.3KB each) instead of a copy a model.
|
||||
func sharedEntry(p *Provider, m catalog.Model, s settings.Settings) Entry {
|
||||
ctx := p.windowIn(m, s)
|
||||
output := p.replyLimit(m, s)
|
||||
images := m.Images || catalog.SeesImages(m.ID)
|
||||
@@ -3660,16 +3666,16 @@ func Resolve(id string) (Provider, string, bool) {
|
||||
// poll, every 15s)
|
||||
entries := providerEntries()
|
||||
if e, ok := entryIn(groupEntries(entries), id); ok {
|
||||
return e.Provider, e.Model, true
|
||||
return *e.Provider, e.Model, true
|
||||
}
|
||||
if e, ok := entryIn(Catalog(), id); ok {
|
||||
return e.Provider, e.Model, true
|
||||
return *e.Provider, e.Model, true
|
||||
}
|
||||
// a group renamed from it (Former) answers for it, as routing does
|
||||
if gid, ok := GroupIDOf(id); ok {
|
||||
if g, ok := routedGroupOf(sharedGroupsIn(entries), gid); ok && g.ID != gid {
|
||||
if e, ok := entryIn(groupEntries(entries), "group/"+g.ID); ok {
|
||||
return e.Provider, e.Model, true
|
||||
return *e.Provider, e.Model, true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3683,7 +3689,7 @@ func resolveIn(entries []Entry, id string) (Provider, string, bool) {
|
||||
// one looked past was most of a group's members resolved (membersIn)
|
||||
for i := range entries {
|
||||
if e := &entries[i]; e.ID == id {
|
||||
return e.Provider, e.Model, true
|
||||
return *e.Provider, e.Model, true
|
||||
}
|
||||
}
|
||||
if pid, model, ok := strings.Cut(id, "/"); ok {
|
||||
@@ -3695,7 +3701,7 @@ func resolveIn(entries []Entry, id string) (Provider, string, bool) {
|
||||
}
|
||||
for i := range entries {
|
||||
if e := &entries[i]; e.Model == id {
|
||||
return e.Provider, e.Model, true // the first that serves it
|
||||
return *e.Provider, e.Model, true // the first that serves it
|
||||
}
|
||||
}
|
||||
// not exposed, but some provider lists it
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestSameModelVendorSpellings(t *testing.T) {
|
||||
t.Errorf("%s and %s merged as %s", pair[0], pair[1], sameModel(pair[0]))
|
||||
}
|
||||
}
|
||||
e := func(p, m string) Entry { return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: Provider{ID: p}} }
|
||||
e := func(p, m string) Entry { return Entry{ID: p + "/" + m, Model: m, Name: m, Provider: &Provider{ID: p}} }
|
||||
gs := autoGroups([]Entry{e("volcengine", "deepseek-v4-1-flash-260910"), e("ali-tp", "deepseek-v4.1-flash")}, nil)
|
||||
if len(gs) != 1 || gs[0].ID != "auto-deepseek-v4-1-flash" || !slices.Equal(gs[0].Members, []string{"volcengine/deepseek-v4-1-flash-260910", "ali-tp/deepseek-v4.1-flash"}) {
|
||||
t.Fatalf("groups: %+v", gs)
|
||||
|
||||
@@ -15,7 +15,7 @@ func NativeEndpoints(e Entry) []string {
|
||||
if e.Group != "" {
|
||||
return nil
|
||||
}
|
||||
return endpointsOf(relayed(e.Provider, e.Model))
|
||||
return endpointsOf(relayed(*e.Provider, e.Model))
|
||||
}
|
||||
|
||||
// relayed are the APIs p takes a request for model on as it is, in the
|
||||
|
||||
@@ -100,7 +100,7 @@ func ownEntry(entries []Entry, agent, id string) *Entry {
|
||||
k := sameModel(id)
|
||||
for i := range entries {
|
||||
e := &entries[i]
|
||||
if e.Group != "" || !ownAgent(e.Provider, agent) {
|
||||
if e.Group != "" || !ownAgent(*e.Provider, agent) {
|
||||
continue
|
||||
}
|
||||
if e.Model == id {
|
||||
|
||||
@@ -12,7 +12,7 @@ func ownEntries() []Entry {
|
||||
codex := Provider{ID: "codex", Account: &Account{Agent: "codex", User: "a@example.com"}}
|
||||
devin := Provider{ID: "devin-plugin", Account: &Account{Agent: "plugin"}}
|
||||
relay := Provider{ID: "relay"}
|
||||
e := func(p Provider, m string) Entry { return Entry{ID: p.ID + "/" + m, Model: m, Provider: p} }
|
||||
e := func(p Provider, m string) Entry { return Entry{ID: p.ID + "/" + m, Model: m, Provider: &p} }
|
||||
return []Entry{
|
||||
e(relay, "gpt-6-astra"), e(relay, "glm-6"),
|
||||
e(devin, "gpt-6-astra"), e(devin, "glm-6"),
|
||||
@@ -51,7 +51,7 @@ func TestOwnRoute(t *testing.T) {
|
||||
}
|
||||
}
|
||||
// spelt otherwise by the vendor (sameModel), still its own
|
||||
dotted := []Entry{{ID: "codex/gpt-6.1-sol", Model: "gpt-6.1-sol", Provider: Provider{ID: "codex", Account: &Account{Agent: "codex"}}}}
|
||||
dotted := []Entry{{ID: "codex/gpt-6.1-sol", Model: "gpt-6.1-sol", Provider: &Provider{ID: "codex", Account: &Account{Agent: "codex"}}}}
|
||||
if to, _, ok := ownRouteIn(dotted, nil, "codex", "gpt-6-1-sol"); !ok || to != "codex/gpt-6.1-sol" {
|
||||
t.Errorf("by its vendor's spelling: %q %v", to, ok)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func TestEntryQuiet(t *testing.T) {
|
||||
// a provider signed in through a plugin: its own account list is a
|
||||
// word on every model it serves, and says nothing of reasoning for
|
||||
// this one — the shape the Trae plugin's model was read as (#950)
|
||||
plugin := Entry{ID: "plugin/m", Model: "m", Provider: Provider{ID: "plugin",
|
||||
plugin := Entry{ID: "plugin/m", Model: "m", Provider: &Provider{ID: "plugin",
|
||||
Account: &Account{Agent: "plugin", models: func() []catalog.Model { return nil }}}}
|
||||
if !plugin.Quiet() {
|
||||
t.Errorf("a plugin's model with no reasoning: Quiet false (reasoning %v, levels %v)", plugin.Reasoning, plugin.Efforts)
|
||||
|
||||
@@ -277,7 +277,7 @@ func TestAgentPricerLeavesTheRateWindowOut(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
none := func(string) (Group, []Member, bool) { return Group{}, nil, false }
|
||||
e := Entry{ID: "relay/sol", Model: "sol", Provider: p}
|
||||
e := Entry{ID: "relay/sol", Model: "sol", Provider: &p}
|
||||
if pr, ok := AgentPricer(settings.Load(), none)(e); !ok || pr.Input != 4 || pr.Output != 20 {
|
||||
t.Fatalf("an agent file's price under an all-day 3× window: %+v %v, want the 2× relay's 4 and 20", pr, ok)
|
||||
}
|
||||
@@ -292,7 +292,7 @@ func TestAgentPricerLeavesTheRateWindowOut(t *testing.T) {
|
||||
group := func(string) (Group, []Member, bool) {
|
||||
return Group{}, []Member{{Provider: p, Model: "sol"}, {Provider: q, Model: "sol"}}, true
|
||||
}
|
||||
g := Entry{ID: "auto/sol", Model: "sol", Group: "auto", Provider: p}
|
||||
g := Entry{ID: "auto/sol", Model: "sol", Group: "auto", Provider: &p}
|
||||
if pr, ok := AgentPricer(settings.Load(), group)(g); !ok || pr.Input != 4 {
|
||||
t.Fatalf("a mixed group's first member in an agent file: %+v %v, want 4", pr, ok)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestAgentSuffix(t *testing.T) {
|
||||
if AgentSuffix("pi") != SuffixOn || AgentSuffix("codex") != "" {
|
||||
t.Fatalf("own %q %q", AgentSuffix("pi"), AgentSuffix("codex"))
|
||||
}
|
||||
es := []Entry{{ID: "relay/glm-5", Name: "GLM-5", Provider: Provider{ID: "relay", Name: "Relay"}}}
|
||||
es := []Entry{{ID: "relay/glm-5", Name: "GLM-5", Provider: &Provider{ID: "relay", Name: "Relay"}}}
|
||||
if got := LabelsFor("pi", es); !slices.Equal(got, []string{"GLM-5 · Relay"}) {
|
||||
t.Fatalf("pi %q", got)
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ func TestServedByAndUpstreamLabel(t *testing.T) {
|
||||
e Entry
|
||||
by, label string
|
||||
}{
|
||||
{Entry{Name: "DeepSeek Chat", Provider: relay}, "Relay A", "DeepSeek Chat · Relay A"},
|
||||
{Entry{Name: "Fast", Group: "fast", Provider: relay}, "routing group", "Fast · routing group"},
|
||||
{Entry{Name: "DeepSeek Chat · Relay A", Plain: "DeepSeek Chat", By: "Relay A", Provider: remote}, "Relay A", "DeepSeek Chat · Office › Relay A"},
|
||||
{Entry{Name: "Mine", Default: "DeepSeek Chat", By: "Relay A", Provider: remote}, "Relay A", "Mine · Office › Relay A"},
|
||||
{Entry{Name: "DeepSeek Chat · Relay A", Plain: "DeepSeek Chat", Provider: remote}, "Office", "DeepSeek Chat · Relay A · Office"},
|
||||
{Entry{Name: "DeepSeek Chat", Provider: &relay}, "Relay A", "DeepSeek Chat · Relay A"},
|
||||
{Entry{Name: "Fast", Group: "fast", Provider: &relay}, "routing group", "Fast · routing group"},
|
||||
{Entry{Name: "DeepSeek Chat · Relay A", Plain: "DeepSeek Chat", By: "Relay A", Provider: &remote}, "Relay A", "DeepSeek Chat · Office › Relay A"},
|
||||
{Entry{Name: "Mine", Default: "DeepSeek Chat", By: "Relay A", Provider: &remote}, "Relay A", "Mine · Office › Relay A"},
|
||||
{Entry{Name: "DeepSeek Chat · Relay A", Plain: "DeepSeek Chat", Provider: &remote}, "Office", "DeepSeek Chat · Relay A · Office"},
|
||||
// upstream names on a provider that isn't a Remote magpie do nothing
|
||||
{Entry{Name: "DeepSeek Chat", By: "Relay A", Provider: Provider{ID: "x", Name: "X", UpstreamProviders: true}}, "X", "DeepSeek Chat · X"},
|
||||
{Entry{Name: "DeepSeek Chat", By: "Relay A", Provider: &Provider{ID: "x", Name: "X", UpstreamProviders: true}}, "X", "DeepSeek Chat · X"},
|
||||
} {
|
||||
if got := c.e.ServedBy(); got != c.by {
|
||||
t.Errorf("%+v: served by %q, want %q", c.e, got, c.by)
|
||||
|
||||
Reference in New Issue
Block a user