前端增加3:4选择
This commit is contained in:
1 parent
98c6127ef7
commit
b340fc7ad7
63 files changed
+51
-917
No files matched your search
@@ -70,7 +70,7 @@ func evolinkDimensions() []ParameterDimension {
|
||||
return []ParameterDimension{
|
||||
{Key: "quality", BaselineValue: "medium", DefaultValue: "medium", Tiers: tiers("low", .11, "medium", 1.0, "high", 4.0)},
|
||||
{Key: "resolution", BaselineValue: "1K", DefaultValue: "1K", Tiers: tiers("1K", 1.0, "2K", 4.0, "4K", 8.0)},
|
||||
{Key: "aspectRatio", BaselineValue: "1:1", DefaultValue: "1:1", Tiers: tiers("1:1", 1.0, "4:3", 1.0, "16:9", 1.0, "9:16", 1.0)},
|
||||
{Key: "aspectRatio", BaselineValue: "1:1", DefaultValue: "1:1", Tiers: tiers("1:1", 1.0, "4:3", 1.0, "3:4", 1.0, "16:9", 1.0, "9:16", 1.0)},
|
||||
{Key: "referenceImageCount", BaselineValue: 0, DefaultValue: 0, Tiers: []ParameterTier{
|
||||
{Value: 0, StandardFactor: 1, MarkupMultiplier: DefaultBillingMarkupMultiplier, Enabled: true},
|
||||
{Value: "1–4", Match: map[string]any{"min": 1, "max": 4}, StandardFactor: 1, MarkupMultiplier: DefaultBillingMarkupMultiplier, Enabled: true},
|
||||
|
||||
@@ -35,3 +35,24 @@ func TestDefaultBillingPriceRulesFreezeOfficialCatalogMatchKeys(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultEvoLinkBillingSupportsThreeByFourAspectRatio(t *testing.T) {
|
||||
for _, rule := range DefaultBillingPriceRules() {
|
||||
if rule.Provider != "evolink" || rule.Capability != "image.generate" {
|
||||
continue
|
||||
}
|
||||
for _, dimension := range rule.Dimensions {
|
||||
if dimension.Key != "aspectRatio" {
|
||||
continue
|
||||
}
|
||||
for _, tier := range dimension.Tiers {
|
||||
if tier.Value == "3:4" && tier.Enabled && tier.StandardFactor == 1 {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatal("evolink aspectRatio dimension does not contain an enabled 3:4 tier with factor 1")
|
||||
}
|
||||
t.Fatal("evolink billing rule does not contain an aspectRatio dimension")
|
||||
}
|
||||
t.Fatal("default evolink image billing rule is missing")
|
||||
}
|
||||
@@ -44,6 +44,25 @@ func TestServiceQuoteNormalizesPayloadAndSeedsDefaultsThroughOptionalCapability(
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceQuoteSupportsEvoLinkThreeByFourPreset(t *testing.T) {
|
||||
store := "eStoreStub{rules: []PriceRule{{
|
||||
ID: "evolink-3-4", Provider: "evolink", Capability: "image.generate", ReqKey: "gpt-image-2",
|
||||
Unit: UnitImage, StandardUnitPriceFen: 34, MarkupMultiplier: 1.2, Enabled: true, Dimensions: evolinkDimensions(),
|
||||
}}}
|
||||
quote, err := NewService(store, nil).Quote(context.Background(), QuoteCommand{
|
||||
Provider: "evolink", Capability: "image.generate", ReqKey: "gpt-image-2",
|
||||
Payload: map[string]any{"input": map[string]any{
|
||||
"width": 1728.0, "height": 2304.0, "quality": "medium",
|
||||
}},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if quote.AmountFen != 41 || quote.Parameters["aspectRatio"] != "3:4" {
|
||||
t.Fatalf("quote = %#v", quote)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceQuoteDisabledReturnsNilWithoutAccessingRules(t *testing.T) {
|
||||
store := "eStoreStub{failOnAccess: true}
|
||||
quote, err := NewService(store, nil).SetEnabled(false).Quote(context.Background(), QuoteCommand{Provider: "seedance", Capability: "video.generate"})
|
||||
|
||||
Reference in new issue
Block a user