From 95c0f1779a765f5430ba3f045d97b514b037ab7d Mon Sep 17 00:00:00 2001
From: Xinfan Chen <2024111082@stu.hit.edu.cn>
Date: Tue, 28 Apr 2026 09:29:59 +0800
Subject: [PATCH] add new video model: happyhorse
---
aigc-director/aigc-claw/backend/tool/video_client.py | 46 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/aigc-director/aigc-claw/backend/tool/video_client.py b/aigc-director/aigc-claw/backend/tool/video_client.py
index bb87bd2..bb9f939 100644
--- a/aigc-director/aigc-claw/backend/tool/video_client.py
+++ b/aigc-director/aigc-claw/backend/tool/video_client.py
@@ -1,7 +1,7 @@
"""
统一视频生成客户端
根据 model 名称自动路由到对应后端:
- - wan* → WanVideoClient (DashScope VideoSynthesis)
+ - wan* → DashscopeVideoClient (DashScope VideoSynthesis)
- jimeng* → JiMengClient (火山引擎即梦)
- kling* → KlingVideoClient (可灵 AI)
"""
@@ -12,13 +12,15 @@
from config import Config
try:
- from tool.video_wan import WanVideoClient
+ from tool.video_dashscope import DashscopeVideoClient
from tool.image_jimeng import JiMengClient
from tool.video_kling import KlingVideoClient
+ from tool.video_seedance import SeedanceVideoClient
except ImportError:
- from video_wan import WanVideoClient
+ from video_dashscope import DashscopeVideoClient
from image_jimeng import JiMengClient
from video_kling import KlingVideoClient
+ from video_seedance import SeedanceVideoClient
logger = logging.getLogger(__name__)
@@ -41,7 +43,7 @@
kling_base_url: Optional[str] = None,
):
# 万象客户端
- self.wan_client = WanVideoClient(
+ self.Dashscope_client = DashscopeVideoClient(
api_key=dashscope_api_key,
base_url=dashscope_base_url,
)
@@ -60,12 +62,18 @@
base_url=kling_base_url,
)
+ # Seedance 客户端
+ self.seedance_client = SeedanceVideoClient(
+ api_key=os.getenv("ARK_API_KEY"),
+ base_url=os.getenv("ARK_BASE_URL"),
+ )
+
def generate_video(
self,
prompt: str,
image_path: str,
save_path: str,
- model: str = "wan2.6-i2v-flash",
+ model: str = "wan2.7-i2v",
duration: int = 5,
shot_type: str = "multi",
sound: str = "",
@@ -90,7 +98,7 @@
RuntimeError: 生成或下载失败
"""
if not model:
- model = "wan2.6-i2v-flash"
+ model = "wan2.7-i2v"
if Config.PRINT_MODEL_INPUT:
print("---- VIDEO GENERATION REQUEST ----")
@@ -111,8 +119,12 @@
return self._generate_jimeng(prompt, image_path, save_path, model, video_ratio)
elif "kling" in model_lower:
return self._generate_kling(prompt, image_path, save_path, model, duration, sound)
- else:
+ elif "seedance" in model_lower:
+ return self._generate_seedance(prompt, image_path, save_path, model, duration)
+ elif "wan" in model_lower or "happyhorse" in model_lower:
return self._generate_wan(prompt, image_path, save_path, model, duration, shot_type)
+ else:
+ raise ValueError(f"未知的视频生成模型: {model}")
def _generate_wan(
self,
@@ -125,7 +137,7 @@
) -> str:
"""通过万象模型生成视频"""
logger.info(f"VideoClient: 路由至万象 model={model}")
- return self.wan_client.generate_video(
+ return self.Dashscope_client.generate_video(
prompt=prompt,
image_path=image_path,
save_path=save_path,
@@ -187,3 +199,21 @@
duration=duration,
sound=sound,
)
+
+ def _generate_seedance(
+ self,
+ prompt: str,
+ image_path: str,
+ save_path: str,
+ model: str,
+ duration: int = 5,
+ ) -> str:
+ """通过 Seedance 模型生成视频"""
+ logger.info(f"VideoClient: 路由至 Seedance model={model}")
+ return self.seedance_client.generate_video(
+ prompt=prompt,
+ image_path=image_path,
+ save_path=save_path,
+ model=model,
+ duration=duration,
+ )
--
Gitblit v1.8.0