Restore standard MiniMax resolutions and client mapping
This commit is contained in:
@@ -28,6 +28,38 @@ func TestFilterRuntimeCandidatesByRequestResolutionKeepsSupportedCandidate(t *te
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterRuntimeCandidatesUsesStandardVideoResolutionValues(t *testing.T) {
|
||||
candidates := []store.RuntimeModelCandidate{
|
||||
{
|
||||
PlatformID: "minimax",
|
||||
PlatformKey: "minimax",
|
||||
PlatformName: "MiniMax",
|
||||
PlatformModelID: "hailuo23",
|
||||
ModelName: "MiniMax-Hailuo-2.3",
|
||||
ModelAlias: "海螺2.3",
|
||||
ModelType: "video_generate",
|
||||
Capabilities: map[string]any{
|
||||
"video_generate": map[string]any{
|
||||
"output_resolutions": []any{"720p", "1080p"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
filtered, summary, err := filterRuntimeCandidatesByRequest("videos.generations", "海螺2.3", "video_generate", map[string]any{
|
||||
"resolution": "720p",
|
||||
}, candidates)
|
||||
if err != nil {
|
||||
t.Fatalf("standard 720p request should match MiniMax catalog capability before client-side upstream mapping: %v", err)
|
||||
}
|
||||
if len(filtered) != 1 || filtered[0].PlatformModelID != "hailuo23" {
|
||||
t.Fatalf("expected MiniMax candidate to remain, got %+v", filtered)
|
||||
}
|
||||
if summary["supportedCandidateCount"] != 1 || summary["filteredCandidateCount"] != 0 {
|
||||
t.Fatalf("unexpected filter summary: %+v", summary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterRuntimeCandidatesByScopedVideoResolution(t *testing.T) {
|
||||
candidates := []store.RuntimeModelCandidate{
|
||||
{
|
||||
|
||||
@@ -323,6 +323,19 @@ func weightValueAliases(key string, name string) []string {
|
||||
return nil
|
||||
}
|
||||
switch key {
|
||||
case "resolutionWeights":
|
||||
aliases := []string{name}
|
||||
lower := strings.ToLower(name)
|
||||
if lower != name {
|
||||
aliases = append(aliases, lower)
|
||||
}
|
||||
if strings.HasSuffix(lower, "p") {
|
||||
aliases = append(aliases, strings.TrimSuffix(lower, "p")+"P")
|
||||
}
|
||||
if lower == "768p" {
|
||||
aliases = append(aliases, "720p")
|
||||
}
|
||||
return aliases
|
||||
case "audioWeights":
|
||||
return []string{name, "audio-" + name}
|
||||
case "referenceVideoWeights":
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestVideoBillingEstimateUsesFiveSecondUnitsAndDynamicWeights(t *testing.T)
|
||||
"video": map[string]any{
|
||||
"basePrice": 100,
|
||||
"dynamicWeight": map[string]any{
|
||||
"resolutionWeights": map[string]any{"1080p": 1.5},
|
||||
"resolutionWeights": map[string]any{"720p": 1.25, "1080p": 1.5},
|
||||
"audioWeights": map[string]any{"true": 2},
|
||||
"referenceVideoWeights": map[string]any{"true": 1.5},
|
||||
"voiceSpecifiedWeights": map[string]any{"true": 1.2},
|
||||
@@ -59,7 +59,7 @@ func TestVideoBillingEstimateUsesFiveSecondUnitsAndDynamicWeights(t *testing.T)
|
||||
items := service.billings(context.Background(), nil, "videos.generations", map[string]any{
|
||||
"audio": true,
|
||||
"duration": 12,
|
||||
"resolution": "1080p",
|
||||
"resolution": "1080P",
|
||||
"voice_id": "voice-a",
|
||||
"content": []any{
|
||||
map[string]any{"type": "video_url", "video_url": map[string]any{"url": "https://example.com/reference.mp4"}},
|
||||
@@ -82,6 +82,15 @@ func TestVideoBillingEstimateUsesFiveSecondUnitsAndDynamicWeights(t *testing.T)
|
||||
if got, want := line["audioSource"], "preprocessed_request"; got != want {
|
||||
t.Fatalf("video audio source = %v, want %v", got, want)
|
||||
}
|
||||
|
||||
items = service.billings(context.Background(), nil, "videos.generations", map[string]any{
|
||||
"duration": 5,
|
||||
"resolution": "768P",
|
||||
}, candidate, clients.Response{}, true)
|
||||
line = firstBillingLine(t, items)
|
||||
if got, want := floatFromAny(line["amount"]), 125.0; got != want {
|
||||
t.Fatalf("768P should use 720p billing weight, got %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMusicBillingUsesSongResourceAndOutputCount(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user