From 2f48fc1d4c80a4c25a04d5f4e1e6c19fbb3528db Mon Sep 17 00:00:00 2001
From: hit-cxf <2024111082@stu.hit.edu.cn>
Date: Thu, 23 Apr 2026 11:53:33 +0800
Subject: [PATCH] fix: add kimi to models.ts
---
aigc-director/aigc-claw/backend/tool/video_client.py | 42 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/aigc-director/aigc-claw/backend/tool/video_client.py b/aigc-director/aigc-claw/backend/tool/video_client.py
index 3cf511c..99959f8 100644
--- a/aigc-director/aigc-claw/backend/tool/video_client.py
+++ b/aigc-director/aigc-claw/backend/tool/video_client.py
@@ -15,10 +15,12 @@
from tool.video_wan import WanVideoClient
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 image_jimeng import JiMengClient
from video_kling import KlingVideoClient
+ from video_seedance import SeedanceVideoClient
logger = logging.getLogger(__name__)
@@ -60,15 +62,22 @@
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 = "",
+ video_ratio: str = "16:9",
) -> str:
"""
生成视频
@@ -89,12 +98,15 @@
RuntimeError: 生成或下载失败
"""
if not model:
- model = "wan2.6-i2v-flash"
+ model = "wan2.7-i2v"
if Config.PRINT_MODEL_INPUT:
print("---- VIDEO GENERATION REQUEST ----")
print(f"Prompt: {prompt}")
- print(f"Image: {image_path}")
+ if image_path and str(image_path).startswith("data:"):
+ print(f"Image: [Base64图片]")
+ else:
+ print(f"Image: {image_path}")
print(f"Model: {model}")
print(f"Duration: {duration}s")
print(f"Shot Type: {shot_type}")
@@ -104,9 +116,11 @@
model_lower = model.lower()
if "jimeng" in model_lower:
- return self._generate_jimeng(prompt, image_path, save_path, model)
+ 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)
+ elif "seedance" in model_lower:
+ return self._generate_seedance(prompt, image_path, save_path, model, duration)
else:
return self._generate_wan(prompt, image_path, save_path, model, duration, shot_type)
@@ -136,12 +150,14 @@
image_path: str,
save_path: str,
model: str,
+ video_ratio: str = "16:9",
) -> str:
"""通过即梦模型生成视频"""
logger.info(f"VideoClient: 路由至即梦 model={model}")
task_id = self.jimeng_client.generate_video(
prompt=prompt,
image_path=image_path,
+ aspect_ratio=video_ratio,
)
# 轮询获取结果
@@ -181,3 +197,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