fix: polish parameter preprocessing details
This commit is contained in:
@@ -180,6 +180,44 @@ func TestParamProcessorVideoCapabilitiesNormalizeAndFilter(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParamProcessorVideoGenerateLogsFirstFrameRemoval(t *testing.T) {
|
||||
body := map[string]any{
|
||||
"model": "Seedance T2V",
|
||||
"prompt": "animate it",
|
||||
"content": []any{
|
||||
map[string]any{"type": "text", "text": "animate it"},
|
||||
map[string]any{"type": "image_url", "role": "first_frame", "image_url": "https://example.com/first.png"},
|
||||
},
|
||||
}
|
||||
candidate := store.RuntimeModelCandidate{
|
||||
ModelType: "video_generate",
|
||||
Capabilities: map[string]any{
|
||||
"video_generate": map[string]any{
|
||||
"duration_range": []any{3, 12},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
result := preprocessRequestWithLog("videos.generations", body, candidate)
|
||||
for _, item := range contentItems(result.Body["content"]) {
|
||||
if isImageContent(item) {
|
||||
t.Fatalf("first frame image should be removed for video_generate: %+v", result.Body["content"])
|
||||
}
|
||||
}
|
||||
for _, change := range result.Log.Changes {
|
||||
if change.Path == "content[1]" {
|
||||
if change.Reason != "模型能力未开启首帧输入,已移除 first_frame。" {
|
||||
t.Fatalf("unexpected first frame removal reason: %+v", change)
|
||||
}
|
||||
if change.CapabilityPath != "capabilities.video_generate.input_first_frame" {
|
||||
t.Fatalf("unexpected first frame capability path: %+v", change)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("expected first frame removal log, got %+v", result.Log.Changes)
|
||||
}
|
||||
|
||||
func TestParamProcessorImageResolutionAndOutputCount(t *testing.T) {
|
||||
body := map[string]any{
|
||||
"model": "即梦V4.0",
|
||||
|
||||
Reference in New Issue
Block a user