Files
Agent-System-Backend/internal/profiles/profiles_test.go
T
weichenandCursor cfde38de31 Send current-turn images and keep vision fallbacks capable
Why: Uploaded images never reached the model, so a text-only chat model could be asked to read a picture it cannot see.

Evidence: go test ./internal/... passed locally before this commit. Image-link rejection is covered by vision package tests.

Impact: Current-turn attachments and fetched image links become image input. History keeps a text placeholder. Image turns swap to the configured vision model when the chat model is not in the capable list, and fallbacks are filtered the same way.

Refs: Agent-System-Dev feature/four-model-vision
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-14 17:51:17 +00:00

53 lines
1.2 KiB
Go

package profiles
import (
"path/filepath"
"testing"
"agent-system-backend/internal/store"
core "agent-system-core"
)
func TestBuiltinProfilesRoundTripAndReadOnly(t *testing.T) {
st, err := store.OpenSQLite(filepath.Join(t.TempDir(), "p.db"))
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { st.Close() })
svc := New(st)
if err := svc.EnsureDefault(); err != nil {
t.Fatal(err)
}
if err := svc.EnsureDefault(); err != nil {
t.Fatal(err)
}
want := map[string]string{
DefaultProfileID: "",
FastProfileID: "qwen3.8-flash",
ReasoningProfileID: "ZHIPU/GLM-5.3-FlashX",
WritingProfileID: "ZHIPU/GLM-5.3-Flash",
}
for id, model := range want {
got, err := svc.Get(OwnerDefault, id)
if err != nil {
t.Fatal(err)
}
if !got.Builtin || got.Model.Chat != model {
t.Fatalf("%s: builtin=%v model=%q", id, got.Builtin, got.Model.Chat)
}
if err := svc.Save("local", core.AgentProfile{ID: id, Name: "改"}); err == nil {
t.Fatalf("save %s should be rejected", id)
}
if err := svc.Delete("local", id); err == nil {
t.Fatalf("delete %s should be rejected", id)
}
}
listed, err := svc.List(OwnerDefault)
if err != nil {
t.Fatal(err)
}
if len(listed) != len(want) {
t.Fatalf("listed %d", len(listed))
}
}