The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
74 lines
2.3 KiB
Go
74 lines
2.3 KiB
Go
package gui
|
||
|
||
import (
|
||
"os"
|
||
"slices"
|
||
"testing"
|
||
|
||
"github.com/yetone/magpie/internal/provider"
|
||
"github.com/yetone/magpie/internal/settings"
|
||
)
|
||
|
||
// Settings › Models › Images › Video generation lists a custom provider's model the
|
||
// user marked a video model (#1399), and none of its others; one unticked
|
||
// in its editor is left out unless it is the one picked; a pick no longer
|
||
// marked is said missing, with Automatic's named.
|
||
func TestVideoGenModelsListed(t *testing.T) {
|
||
t.Setenv("HOME", t.TempDir())
|
||
t.Setenv("USERPROFILE", os.Getenv("HOME"))
|
||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||
if err := provider.Save(provider.Provider{ID: "studio", Name: "Studio", Chat: "https://studio.example/v1", Key: "sk-s", Models: []string{"chat-1", "seedance-x", "kling-y"}}); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
for _, ref := range []string{"studio/seedance-x", "studio/kling-y"} {
|
||
if err := provider.SetModelKind(ref, provider.KindVideo); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
}
|
||
listed := func() (ids []string) {
|
||
for _, m := range settingsState().VideoGenModels {
|
||
if m.Provider == "studio" {
|
||
ids = append(ids, m.ID)
|
||
}
|
||
}
|
||
slices.Sort(ids)
|
||
return
|
||
}
|
||
if got := listed(); !slices.Equal(got, []string{"studio/kling-y", "studio/seedance-x"}) {
|
||
t.Fatalf("listed %v", got)
|
||
}
|
||
if a := settingsState().VideoGenAuto; a == "" {
|
||
t.Fatal("no automatic video model")
|
||
}
|
||
|
||
p, _ := provider.Find("studio")
|
||
q := *p
|
||
q.HiddenVideomakers = []string{"kling-y"}
|
||
if err := provider.Save(q); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if got := listed(); !slices.Equal(got, []string{"studio/seedance-x"}) {
|
||
t.Fatalf("an unticked one is listed: %v", got)
|
||
}
|
||
st := settings.Load()
|
||
st.VideoGen = "studio/kling-y"
|
||
if err := settings.Save(st); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if got := listed(); !slices.Equal(got, []string{"studio/kling-y", "studio/seedance-x"}) {
|
||
t.Fatalf("the unticked pick isn't listed: %v", got)
|
||
}
|
||
if m := settingsState().VideoGenMissing; m != "" {
|
||
t.Fatalf("a marked pick said missing: %q", m)
|
||
}
|
||
|
||
if err := provider.SetModelKind("studio/kling-y", ""); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
s := settingsState()
|
||
if s.VideoGenMissing != "studio/kling-y" || s.VideoGenAuto != "studio/seedance-x" {
|
||
t.Fatalf("unmarked pick: missing %q, automatic %q", s.VideoGenMissing, s.VideoGenAuto)
|
||
}
|
||
}
|