nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are Trae's own names, light, high and extra_high, and dsh offered only default and high: dshModelLevels (and Pi's piThinkingLevels) matched a model's efforts to pi-ai's level names only, so light and extra_high were dropped. The gateway dropped them too: effortOf read "light" as no effort, and NearestEffort fitted an agent's low or xhigh to the plugin's high. catalog.EffortAliases names light as low and extra_high as xhigh (EffortLevel). NearestEffort places a model's levels by the level they name and returns the model's own word; the gateway's effortOf reads an alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai reads each value as "the spelling dispatch sends"). Levels a user kept are untouched: only the names a model lists are mapped. Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords (catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a real plugin host with the fake plugin listing light/high/extra_high). Broken by hand: modelEffort without the alias, dsh levels [high] (the report's picker); NearestEffort without EffortLevel, low/xhigh sent as high; effortOf without the alias, light/extra_high sent as nothing. Run on mote at this tree (basee4ccf67b1): go build, GOOS=linux and GOOS=windows go vet -tags nogui ./... ok; go test -tags nogui -timeout 45m ./... : 73 packages ok, three red that are red the same on origin/main7f32f0ec9run alone: internal/agent TestWSLColdPlaceOpensNothing (#3924), internal/tui TestTUIFetchesSubscriptionModels (#3919), internal/provider synctest crash in TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so the rest of internal/provider didn't run. No GUI file changed. Rebased on7f32f0ec9(one agent file changed there): go build ./..., internal/catalog whole and gateway/agent -run Effort|Dsh|Pi|ThinkingOff|Level ok at this head. Not tried: a real dsh session against the user's plugin (no Our Free Model account here); dsh's parsing of a non-pi-ai wire value was read from its source, not run.
48 lines
2.1 KiB
Go
48 lines
2.1 KiB
Go
package agent
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/catalog"
|
|
)
|
|
|
|
// TestDshOffersTraeNamedLevels: Our Free Model's plugin lists Trae's
|
|
// DeepSeek V4.1 Flash with the levels Trae names, light, high and
|
|
// extra_high (its 轻, 高 and 极高). dsh offered high alone, since only
|
|
// levels named in pi-ai's words were written (nianshou5 on Discord). Each
|
|
// is now offered as the level of dsh's it is, and sent in the model's own
|
|
// words; Pi's thinkingLevelMap is built the same way.
|
|
func TestDshOffersTraeNamedLevels(t *testing.T) {
|
|
m := catalog.Model{ID: "our-free-model/trae/deepseek-v4.1-flash", Context: 1000000, Output: 64000, Efforts: []string{"light", "high", "extra_high"}}
|
|
levels, got := dshModelLevels(m.Efforts)
|
|
if want := []string{"low", "high", "xhigh"}; !slices.Equal(levels, want) {
|
|
t.Fatalf("dsh levels %v, want %v", levels, want)
|
|
}
|
|
if want := (dshPiLevels{Low: "light", High: "high", XHigh: "extra_high"}); got == nil || *got != want {
|
|
t.Fatalf("dsh reasoningEfforts %+v, want %+v", got, want)
|
|
}
|
|
if e := dshKindConfig(dshKinds[0], []catalog.Model{m}, "", "http://127.0.0.1:3425").Models[0].ReasoningEfforts; e == nil || e.XHigh != "extra_high" || e.Low != "light" {
|
|
t.Fatalf("route entry's reasoningEfforts %+v", e)
|
|
}
|
|
|
|
pi := piThinkingLevels(m.Efforts, false)
|
|
for l, want := range map[string]any{"low": "light", "high": "high", "xhigh": "extra_high", "medium": nil, "max": nil, "off": nil, "minimal": nil} {
|
|
if pi[l] != want {
|
|
t.Errorf("Pi's %s = %v, want %v", l, pi[l], want)
|
|
}
|
|
}
|
|
|
|
// a model naming pi-ai's own levels is as before, and one naming both
|
|
// spellings is sent its own pi-ai name
|
|
if _, std := dshModelLevels([]string{"none", "low", "high", "max"}); std == nil || *std != (dshPiLevels{Off: "none", Low: "low", High: "high", Max: "max"}) {
|
|
t.Errorf("standard levels %+v", std)
|
|
}
|
|
if e := modelEffort([]string{"light", "low"}, "low"); e != "low" {
|
|
t.Errorf("low with light beside it = %q, want low", e)
|
|
}
|
|
if e := modelEffort([]string{"high"}, "low"); e != "" {
|
|
t.Errorf("a level the model doesn't take = %q, want none", e)
|
|
}
|
|
}
|