fix(admin): 模型测试 - 按图片能力使用默认尺寸与质量参数
This commit is contained in:
1 parent
d9440e31dd
commit
787a238ea4
2 files changed
+71
-7
No files matched your search
@@ -38,3 +38,45 @@ func TestNormalizeChannelModelContractRequiresJiMengSecret(t *testing.T) {
|
||||
t.Fatal("normalizeChannelModelContract() should require JiMeng credentials")
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageTestDefaultsUseModelCapability(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
profile *ImageCapabilityConfig
|
||||
wantSize string
|
||||
wantQuality string
|
||||
}{
|
||||
{name: "legacy fallback", wantSize: "1024x1024", wantQuality: "auto"},
|
||||
{
|
||||
name: "fixed 2k model",
|
||||
profile: &ImageCapabilityConfig{
|
||||
Size: ImageSizeConfig{Parameter: "size", Default: "2048x2048"},
|
||||
Quality: ImageQualityConfig{Supported: false, Default: "auto"},
|
||||
},
|
||||
wantSize: "2048x2048",
|
||||
},
|
||||
{
|
||||
name: "provider selected size",
|
||||
profile: &ImageCapabilityConfig{
|
||||
Size: ImageSizeConfig{Parameter: "none", Default: "auto"},
|
||||
Quality: ImageQualityConfig{Supported: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "gpt image capability",
|
||||
profile: &ImageCapabilityConfig{
|
||||
Size: ImageSizeConfig{Parameter: "size", Default: "1024x1536"},
|
||||
Quality: ImageQualityConfig{Supported: true, Default: "high"},
|
||||
},
|
||||
wantSize: "1024x1536", wantQuality: "high",
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
size, quality := imageTestDefaults(test.profile)
|
||||
if size != test.wantSize || quality != test.wantQuality {
|
||||
t.Fatalf("imageTestDefaults() = %q, %q; want %q, %q", size, quality, test.wantSize, test.wantQuality)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user