providers: Command Code's free models are marked free, and providers switched off fold below the ones on (01huadalang on Discord: Space Bunny Alpha 在 Command Code 里是 FREE,magpie 只给 Ling 3.1 Flash 标了免费;已关闭的供应商还占着位置) — magpie marked a model free when the plan said so (m.free) or its id or name said "free"; Command Code's /provider/v1/models says nothing of it, so only ids like inclusionai/ling-3.1-flash:free got 免费. Its CLI (1.73.2) badges eleven models free in its own table (badge:"free"), Space Bunny Alpha and Pixel Canary among them; those are now marked Free on the Go table, on Go's fetched list and on a keyed plan's, so the chips say 免费 with "doesn't use the plan's credits". Neither the CLI nor the API says a discount (no "-99%" anywhere), so none is shown. On the Providers page the providers switched off now sit below the list under a "Turned off (N)" fold (已关闭的供应商), folded at first and remembered per viewer; a click on it moves nothing, and a provider switched off moves under it. TestCommandCodeFreeModels and providers-off-fold.test.cjs fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass (TestClaudeRunEndsWhenTheClientLeaves a load flake, passes alone); providers-off-fold, click-scroll, old-webkit, provider-search, provider-remove, add-sheet, nokey-editor, plain-names, model-test-one pass.
This commit is contained in:
@@ -168,9 +168,34 @@ func cmdGoFetch(ctx context.Context) ([]catalog.Model, error) {
|
||||
if len(out) == 0 {
|
||||
return nil, errors.New("Command Code listed no models for the Go plan")
|
||||
}
|
||||
cmdMarkFree(out)
|
||||
return out, catalog.SaveLive(CommandCodePlanID, base, out)
|
||||
}
|
||||
|
||||
// cmdFree are the models Command Code's CLI marks FREE in its picker
|
||||
// (1.73.2: badge:"free", "{name} is free and uses shared capacity"); its
|
||||
// API's list doesn't say so, and Space Bunny Alpha's and Pixel Canary's
|
||||
// ids name nothing free. Neither says a model is served at a discount.
|
||||
var cmdFree = map[string]bool{
|
||||
"stealth/space-bunny-alpha": true, "stealth/pixel-canary": true,
|
||||
"poolside/laguna-s-2.1-free": true, "inclusionai/ling-3.0-flash-free": true,
|
||||
"inclusionai/ling-3.0-flash-sante:free": true, "inclusionai/ling-3.1-flash:free": true,
|
||||
"MiniMaxAI/MiniMax-M3-Free": true, "minimax/minimax-m3-free": true,
|
||||
"minimax/minimax-m2.7-free": true, "meituan/LongCat-2.0:free": true, "tencent/Hy3": true,
|
||||
}
|
||||
|
||||
// cmdMarkFree marks the models of ms the CLI calls free, in place.
|
||||
func cmdMarkFree(ms []catalog.Model) []catalog.Model {
|
||||
for i := range ms {
|
||||
if cmdFree[ms[i].ID] {
|
||||
ms[i].Free = true
|
||||
}
|
||||
}
|
||||
return ms
|
||||
}
|
||||
|
||||
func init() { cmdMarkFree(cmdGoModels) }
|
||||
|
||||
// cmdAuth is an account's key, as auth.json and the sign-in name it.
|
||||
type cmdAuth struct {
|
||||
APIKey string `json:"apiKey"`
|
||||
@@ -303,7 +328,12 @@ func cmdProvider(who, plan string, a cmdAuth) Provider {
|
||||
}
|
||||
keyed := p
|
||||
keyed.Account, keyed.Key = nil, a.APIKey
|
||||
return keyed.Fetch(ctx)
|
||||
ms, base, err := keyed.fetchOne(keyed.Via(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cmdMarkFree(ms)
|
||||
return catalog.Chat(ms), catalog.SaveLive(p.ID, base, ms)
|
||||
}
|
||||
acct.generate = func(ctx context.Context) (string, bool) {
|
||||
return a.APIKey, cmdPlanNow(ctx, a, plan) == "Go"
|
||||
|
||||
Reference in New Issue
Block a user