若干更新迭代

This commit is contained in:
andy committed 2026-10-02 19:56:32 +08:00
1 parent deb9cc5bcf
commit 4ac786aafb
64 files changed
+3251 -291

No files matched your search

+35
View File
@@ -157,6 +157,41 @@ func TestServiceQuoteReservesMinimaxH3OfficialRateWithMarkup(t *testing.T) {
}
}
func TestServiceQuoteReservesMinimaxH3ExtraReferenceImages(t *testing.T) {
store := &quoteStoreStub{rules: []PriceRule{{
ID: "minimax-h3-2k", Provider: "minimax", Capability: "video.generate", ReqKey: MinimaxH3Model,
VariantKey: "resolution=2k", Unit: UnitVideoSecond, StandardUnitPriceFen: 80, MarkupMultiplier: 1.2, Enabled: true,
}}}
materials := make([]any, 9)
for i := range materials {
materials[i] = map[string]any{"type": "image", "url": "https://cdn.test/ref.png"}
}
quote, err := NewService(store, nil).Quote(context.Background(), QuoteCommand{
Provider: "minimax", Capability: "video.generate", ReqKey: MinimaxH3Model,
Payload: map[string]any{"settings": map[string]any{"duration": 5, "resolution": "2K"}, "materials": materials},
})
if err != nil {
t.Fatal(err)
}
if quote.AmountFen != 576 || quote.ReservedAmountFen != 576 || quote.Parameters["inputImageCount"] != float64(9) || quote.Parameters["inputImagePriceFen"] != float64(80) {
t.Fatalf("quote=%#v", quote)
}
}
func TestServiceQuoteReservesIndependentWan30Price(t *testing.T) {
store := &quoteStoreStub{rules: DefaultBillingPriceRules()}
quote, err := NewService(store, nil).Quote(context.Background(), QuoteCommand{
Provider: "bailian", Capability: "video.generate", ReqKey: BailianWan30VideoModel,
Payload: map[string]any{"settings": map[string]any{"duration": 5, "resolution": "1080P"}},
})
if err != nil {
t.Fatal(err)
}
if quote.PriceRuleID != "base-bailian-wan30-video-1080p" || quote.AmountFen != 720 || quote.ReservedAmountFen != 720 || quote.SettlementStatus != "pending" {
t.Fatalf("quote=%#v", quote)
}
}
func TestServiceQuoteAppliesSeedreamSizeAndReferenceInputPricing(t *testing.T) {
store := &quoteStoreStub{rules: []PriceRule{{
ID: "seedream-5", Provider: "seedream", Capability: "image.generate", ReqKey: Seedream50ProModel,