4629c6af0f
New videogen/ contract package (ADR-0019): Request/Result/Model/Provider
with the imagegen conventions. Text-to-video and image-to-video are one
surface (Request.InitImage, nil = t2v) since hybrid checkpoints like
Wan 2.2 TI2V serve both from one model; Result carries a single clip.
provider/llamaswap gains VideoModel(id) targeting the blocking
POST {base}/v1/videos/sync (multipart, model-routed by the fork's new
video routes): vLLM-Omni parameter names, OpenAI-style input_reference
file part, optional fields stay off the wire so per-model launch-flag
defaults apply. CLAUDE.md package map picks up audio/ (missed in #12)
and videogen/.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXQxVhXBw8PwFAtsVrXSmj
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package videogen
|
|
|
|
import "testing"
|
|
|
|
func TestApplyDoesNotMutateOriginal(t *testing.T) {
|
|
orig := Request{Prompt: "a cat"}
|
|
got := orig.Apply(
|
|
WithSize("1280x704"),
|
|
WithNumFrames(81),
|
|
WithFPS(16),
|
|
WithSteps(4),
|
|
WithGuidanceScale(1.0),
|
|
WithNegativePrompt("blurry"),
|
|
WithSeed(42),
|
|
WithInitImage(Image{MIME: "image/png", Data: []byte{1}}),
|
|
)
|
|
|
|
if orig.Size != "" || orig.NumFrames != 0 || orig.FPS != 0 || orig.Steps != nil ||
|
|
orig.GuidanceScale != nil || orig.NegativePrompt != "" || orig.Seed != nil || orig.InitImage != nil {
|
|
t.Fatalf("original mutated: %+v", orig)
|
|
}
|
|
|
|
if got.Size != "1280x704" || got.NumFrames != 81 || got.FPS != 16 {
|
|
t.Errorf("size/frames/fps = %q/%d/%d", got.Size, got.NumFrames, got.FPS)
|
|
}
|
|
if got.Steps == nil || *got.Steps != 4 {
|
|
t.Errorf("steps = %v", got.Steps)
|
|
}
|
|
if got.GuidanceScale == nil || *got.GuidanceScale != 1.0 {
|
|
t.Errorf("guidance = %v", got.GuidanceScale)
|
|
}
|
|
if got.NegativePrompt != "blurry" {
|
|
t.Errorf("negative = %q", got.NegativePrompt)
|
|
}
|
|
if got.Seed == nil || *got.Seed != 42 {
|
|
t.Errorf("seed = %v", got.Seed)
|
|
}
|
|
if got.InitImage == nil || got.InitImage.MIME != "image/png" {
|
|
t.Errorf("init image = %+v", got.InitImage)
|
|
}
|
|
}
|
|
|
|
func TestApplyModelOptions(t *testing.T) {
|
|
called := false
|
|
ApplyModelOptions([]ModelOption{func(*ModelConfig) { called = true }})
|
|
if !called {
|
|
t.Fatal("model option not applied")
|
|
}
|
|
}
|