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/config_model.json       |    7 +++
 aigc-director/README.md                                 |    5 +-
 aigc-director/aigc-claw/frontend/config/models.ts       |    1 
 aigc-director/aigc-claw/backend/tool/video_dashscope.py |   87 +++++++++++++++++++++++--------------------
 aigc-director/CLAUDE.md                                 |    2 
 aigc-director/aigc-claw/backend/tool/video_client.py    |   14 ++++---
 6 files changed, 66 insertions(+), 50 deletions(-)

diff --git a/aigc-director/CLAUDE.md b/aigc-director/CLAUDE.md
index fc67296..c45e62a 100644
--- a/aigc-director/CLAUDE.md
+++ b/aigc-director/CLAUDE.md
@@ -57,7 +57,7 @@
 External API integrations in `aigc-claw/backend/tool/`:
 - **LLM clients**: llm_dashscope.py, llm_deepseek.py, llm_gpt.py, llm_gemini.py
 - **Image clients**: image_dashscope.py, image_client.py (Seedream, Jimeng, Wan)
-- **Video clients**: video_wan.py, video_kling.py (Wan, Kling)
+- **Video clients**: video_dashscope.py, video_kling.py (Wan, Kling)
 - **VLM clients**: vlm_dashscope.py, vlm_gemini.py
 
 ### Data Storage
diff --git a/aigc-director/README.md b/aigc-director/README.md
index 09e66d5..cc7024e 100644
--- a/aigc-director/README.md
+++ b/aigc-director/README.md
@@ -239,7 +239,7 @@
 
 | API Key | 提供商 | 可用模型 |
 |---------|------|---------|
-| `DASHSCOPE_API_KEY` | 阿里云DashScope | qwen3.6-max-preview, qwen3.6-plus, wan2.6-t2i, wan2.7-i2v, wan2.6-i2v-flash |
+| `DASHSCOPE_API_KEY` | 阿里云DashScope | qwen3.6-max-preview, qwen3.6-plus, wan2.6-t2i, wan2.7-i2v, wan2.6-i2v-flash, happyhorse-1.0-i2v |
 | `ARK_API_KEY` | 字节跳动Seedream | doubao-seedream-5-0-260128 (500次/分钟,高并发) |
 | `VOLC_ACCESS_KEY/SECRET` | 火山引擎即梦 | jimeng_t2i_v40, jimeng_ti2v_v30_pro |
 | `KLING_ACCESS_KEY/SECRET` | 快手可灵 | kling-v3, kling-v2-6, kling-v2-5-turbo |
@@ -253,7 +253,7 @@
 - **VLM 评估模型**: qwen3.6-plus, qwen3.6-flash, kimi-k2.6, gpt-5.4, gemini-2.5-flash-image (性价比最高), gemini-2.0-flash
 - **文生图模型**: wan2.6-t2i, jimeng_t2i_v40, doubao-seedream-5-0-260128, sora_image, gpt-image-2
 - **图生图模型**: wan2.6-t2i, jimeng_t2i_v40, doubao-seedream-5-0-260128, gpt-image-2
-- **视频生成模型**: wan2.7-i2v, wan2.6-i2v-flash, doubao-seedance-2-0-260128, kling-v3, kling-v2-6, kling-v2-5-turbo, jimeng_ti2v_v30_pro
+- **视频生成模型**: wan2.7-i2v, wan2.6-i2v-flash, happyhorse-1.0-i2v, doubao-seedance-2-0-260128, kling-v3, kling-v2-6, kling-v2-5-turbo, jimeng_ti2v_v30_pro
 - **视频比例**: 16:9, 9:16, 1:1, 4:3, 3:4, 21:9
 
 ### 并发配置
@@ -293,6 +293,7 @@
 |------|------|------|------|
 | **wan2.7-i2v** | 5次/秒 | 5个 | 阿里大模型 |
 | **wan2.6-i2v-flash** | 5次/秒 | 5个 | 阿里大模型 (快速) |
+| **happyhorse-1.0-i2v** | 5次/秒 | 5个 | 阿里大模型 |
 | **doubao-seedance-*** | - | 10个 | 字节跳动 |
 | **kling-v3/v2-6/v2-5** | - | 3个 | 快手可灵 |
 | **jimeng_ti2v_v30_pro** | - | 3个 | 即梦视频 |
diff --git a/aigc-director/aigc-claw/backend/config_model.json b/aigc-director/aigc-claw/backend/config_model.json
index 96afac0..17f2f72 100644
--- a/aigc-director/aigc-claw/backend/config_model.json
+++ b/aigc-director/aigc-claw/backend/config_model.json
@@ -205,6 +205,13 @@
       "concurrency": 5,
       "price_per_second": 0.8
     },
+    "happyhorse-1.0-i2v": {
+      "name": "Happy Horse 1.0 I2V",
+      "provider": "dashscope",
+      "type": ["video"],
+      "concurrency": 5,
+      "price_per_second": 1.0
+    },
     "kling-v3": {
       "name": "Kling V3",
       "provider": "kling",
diff --git a/aigc-director/aigc-claw/backend/tool/video_client.py b/aigc-director/aigc-claw/backend/tool/video_client.py
index 99959f8..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,12 +12,12 @@
 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
@@ -43,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,
         )
@@ -121,8 +121,10 @@
             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:
+        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,
@@ -135,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,
diff --git a/aigc-director/aigc-claw/backend/tool/video_wan.py b/aigc-director/aigc-claw/backend/tool/video_dashscope.py
similarity index 64%
rename from aigc-director/aigc-claw/backend/tool/video_wan.py
rename to aigc-director/aigc-claw/backend/tool/video_dashscope.py
index 7df6da1..02ff370 100644
--- a/aigc-director/aigc-claw/backend/tool/video_wan.py
+++ b/aigc-director/aigc-claw/backend/tool/video_dashscope.py
@@ -16,7 +16,7 @@
 logger = logging.getLogger(__name__)
 
 
-class WanVideoClient:
+class DashscopeVideoClient:
     """
     阿里云通义万象视频生成客户端
     使用 dashscope SDK 的 VideoSynthesis 接口
@@ -68,9 +68,9 @@
         abs_img = os.path.abspath(image_path)
         img_url = f"file://{abs_img}"
 
-        logger.info(f"WanVideoClient: model={model}, prompt={prompt[:60]}...")
+        logger.info(f"DashscopeVideoClient: model={model}, prompt={prompt[:60]}...")
 
-        if model.startswith("wan2.7"):
+        if model.startswith("wan2.7") or "happyhorse" in model:
             # wan2.7 series use the new API format with 'media'
             media = [{"type": "first_frame", "url": img_url}]
             rsp = VideoSynthesis.call(
@@ -79,6 +79,7 @@
                 prompt=prompt,
                 media=media,
                 duration=duration,
+                watermark=False,
             )
         else:
             # Older models (wan2.1, wan2.6 etc.) use 'img_url' and 'shot_type'
@@ -102,7 +103,7 @@
         if not video_url:
             raise RuntimeError(f"万象视频 API 返回空URL,可能生成失败: code={rsp.code}, message={rsp.message}")
 
-        logger.info(f"WanVideoClient: 视频生成成功: {video_url}")
+        logger.info(f"DashscopeVideoClient: 视频生成成功: {video_url}")
 
         # 确保输出目录存在
         os.makedirs(os.path.dirname(save_path), exist_ok=True)
@@ -117,7 +118,7 @@
                 if chunk:
                     f.write(chunk)
 
-        logger.info(f"WanVideoClient: 视频已保存: {save_path}")
+        logger.info(f"DashscopeVideoClient: 视频已保存: {save_path}")
         return video_url
 
 
@@ -130,14 +131,15 @@
     logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
 
     # ── 测试参数(按需修改) ──
-    IMAGE_PATH = "code/result/image/test_avail/test_input.png"
-    OUTPUT_PATH = "code/result/video/test_avail/wan_test_output.mp4"
-    PROMPT = "一个赛博朋克风格的城市,霓虹灯闪烁,下着雨"
-    MODEL = "wan2.7-i2v"  # wan2.1-i2v-720p / wan2.1-i2v-480p
+    IMAGE_PATH = "code/result/image/test_avail/test_input_human.jpg"
+    OUTPUT_DIR = "code/result/video/test_avail"
+    PROMPT = "女人把报表交给男人,男人看清楚报表上的数据,露出满意的微笑,办公室背景,写实风格,高清细节。背景音乐:轻快的电子乐,节奏感强,适合办公环境。"
+    # MODELS = ["wan2.7-i2v", "wan2.6-i2v-flash", "happyhorse-1.0-i2v"]
+    MODELS = ["happyhorse-1.0-i2v"]
     DURATION = 5               # 5 / 10
     SHOT_TYPE = "multi"        # single / multi
 
-    print("=== 万象 (Wan) 视频客户端可用性测试 ===")
+    print("=== Dashscope 视频客户端可用性测试 ===")
     ak = Config.DASHSCOPE_API_KEY
     base_url = Config.DASHSCOPE_BASE_URL
     if not ak:
@@ -148,36 +150,39 @@
         print(f"✗ 输入图片不存在: {IMAGE_PATH}")
         sys.exit(1)
 
-    print(f"  API Key    : {ak[:6]}***{ak[-4:]}")
-    print(f"  Base URL   : {base_url}")
-    print(f"  输入图片   : {IMAGE_PATH}")
-    print(f"  输出路径   : {OUTPUT_PATH}")
-    print(f"  模型       : {MODEL}")
-    print(f"  时长       : {DURATION}s")
-    print(f"  镜头类型   : {SHOT_TYPE}")
-    if PROMPT:
-        print(f"  提示词     : {PROMPT[:80]}")
-    print("-" * 40)
+    for model in MODELS:
+        output_path = os.path.join(OUTPUT_DIR, f"{model}.mp4")
+        print(f"\n测试模型: {model}")
+        print(f"  API Key    : {ak[:6]}***{ak[-4:]}")
+        print(f"  Base URL   : {base_url}")
+        print(f"  输入图片   : {IMAGE_PATH}")
+        print(f"  输出路径   : {output_path}")
+        print(f"  模型       : {model}")
+        print(f"  时长       : {DURATION}s")
+        print(f"  镜头类型   : {SHOT_TYPE}")
+        if PROMPT:
+            print(f"  提示词     : {PROMPT[:80]}")
+        print("-" * 40)
 
-    try:
-        client = WanVideoClient(api_key=ak, base_url=base_url)
-        print("✓ 客户端初始化成功")
-        
-        start = time.time()
-        video_url = client.generate_video(
-            prompt=PROMPT,
-            image_path=IMAGE_PATH,
-            save_path=OUTPUT_PATH,
-            model=MODEL,
-            duration=DURATION,
-            shot_type=SHOT_TYPE,
-        )
-        elapsed = time.time() - start
+        try:
+            client = DashscopeVideoClient(api_key=ak, base_url=base_url)
+            print("✓ 客户端初始化成功")
+            
+            start = time.time()
+            video_url = client.generate_video(
+                prompt=PROMPT,
+                image_path=IMAGE_PATH,
+                save_path=output_path,
+                model=model,
+                duration=DURATION,
+                shot_type=SHOT_TYPE,
+            )
+            elapsed = time.time() - start
 
-        print(f"✓ 视频生成完成!耗时 {elapsed:.1f}s")
-        print(f"  远端 URL : {video_url}")
-        print(f"  本地文件 : {os.path.abspath(OUTPUT_PATH)}")
-        print(f"  文件大小 : {os.path.getsize(OUTPUT_PATH) / 1024 / 1024:.2f} MB")
-    except Exception as e:
-        print(f"✗ 失败: {e}")
-        sys.exit(1)
+            print(f"✓ 视频生成完成!耗时 {elapsed:.1f}s")
+            print(f"  远端 URL : {video_url}")
+            print(f"  本地文件 : {os.path.abspath(output_path)}")
+            print(f"  文件大小 : {os.path.getsize(output_path) / 1024 / 1024:.2f} MB")
+        except Exception as e:
+            print(f"✗ 失败: {e}")
+            sys.exit(1)
diff --git a/aigc-director/aigc-claw/frontend/config/models.ts b/aigc-director/aigc-claw/frontend/config/models.ts
index 7e4b813..1177624 100644
--- a/aigc-director/aigc-claw/frontend/config/models.ts
+++ b/aigc-director/aigc-claw/frontend/config/models.ts
@@ -138,6 +138,7 @@
         models: [
             { id: 'wan2.7-i2v', label: 'wan2.7-i2v', default: true },
             { id: 'wan2.6-i2v-flash', label: 'wan2.6-i2v-flash' },
+            { id: 'happyhorse-1.0-i2v', label: 'happyhorse-1.0-i2v' },
         ],
     },
     {

--
Gitblit v1.8.0