Skip to content

World's first open-source, agentic video production system. 12 production pipelines, 100+ tools, 700+ agent skill and production-knowledge files. Turn your AI coding assistant into a full video production studio.

fix: declare env dependencies and map selector duration to frames

Yiyabod4426f6e94cb
diff --git a/tests/contracts/test_jimeng_video.py b/tests/contracts/test_jimeng_video.py
index 5d060dba..56236c18 100644
--- a/tests/contracts/test_jimeng_video.py
+++ b/tests/contracts/test_jimeng_video.py
@@ -378,3 +378,26 @@ class TestSchemaValidation:
schema = JimengVideo().input_schema
for valid in [0, 1, 42, 999999]:
jsonschema.validate({"prompt": "test", "seed": valid}, schema)
+
+
+# ------------------------------------------------------------------
+# Selector duration → frames mapping
+# ------------------------------------------------------------------
+
+class TestSelectorDurationMapping:
+
+ def test_duration_5_maps_to_121_frames(self):
+ payload = JimengVideo._build_payload({"prompt": "x", "duration": 5})
+ assert payload["frames"] == 121
+
+ def test_duration_10_maps_to_241_frames(self):
+ payload = JimengVideo._build_payload({"prompt": "x", "duration": 10})
+ assert payload["frames"] == 241
+
+ def test_duration_defaults_to_5_when_absent(self):
+ payload = JimengVideo._build_payload({"prompt": "x"})
+ assert payload["frames"] == 121
+
+ def test_frames_takes_priority_over_duration(self):
+ payload = JimengVideo._build_payload({"prompt": "x", "frames": 241, "duration": 5})
+ assert payload["frames"] == 241
diff --git a/tools/video/jimeng_video.py b/tools/video/jimeng_video.py
index 9410b864..9000054e 100644
--- a/tools/video/jimeng_video.py
+++ b/tools/video/jimeng_video.py
@@ -57,7 +57,7 @@ class JimengVideo(BaseTool):
determinism = Determinism.STOCHASTIC
runtime = ToolRuntime.API
- dependencies = []
+ dependencies = ["env:VOLC_ACCESSKEY", "env:VOLC_SECRETKEY"]
install_instructions = (
"Set VOLC_ACCESSKEY and VOLC_SECRETKEY to your Volcengine IAM credentials.\n"
" Get them at https://console.volcengine.com/iam/keymanage\n"
@@ -252,13 +252,22 @@ class JimengVideo(BaseTool):
model=_REQ_KEY_VIDEO,
)
+ @staticmethod
+ def _duration_to_frames(duration: int) -> int:
+ if duration >= 10:
+ return 241
+ return 121
+
@staticmethod
def _build_payload(inputs: dict[str, Any]) -> dict[str, Any]:
operation = inputs.get("operation", "text_to_video")
+ frames = inputs.get("frames")
+ if frames is None:
+ frames = JimengVideo._duration_to_frames(int(inputs.get("duration", 5)))
payload: dict[str, Any] = {
"req_key": _REQ_KEY_VIDEO,
"prompt": inputs["prompt"],
- "frames": int(inputs.get("frames", 121)),
+ "frames": int(frames),
"aspect_ratio": inputs.get("aspect_ratio", "16:9"),
"seed": int(inputs.get("seed", -1)),
}