From 2ffbfdcef91bd428c862186ef9fa62e890a86c49 Mon Sep 17 00:00:00 2001
From: log
Date: Mon, 22 Jun 2026 14:17:29 +0800
Subject: [PATCH] feat: support Doubao coding plan LLM and UI configuration

---
 video-claw/video-claw/backend/config.py              |   15 +++++++++++++--
 video-claw/video-claw/backend/models/llm_client.py   |    8 ++++++++
 video-claw/video-claw/backend/config.yaml.example    |    8 ++++++--
 video-claw/video-claw/frontend/app/settings/page.tsx |    9 +++++++++
 4 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/video-claw/video-claw/backend/config.py b/video-claw/video-claw/backend/config.py
index 36a174d..bd46628 100644
--- a/video-claw/video-claw/backend/config.py
+++ b/video-claw/video-claw/backend/config.py
@@ -50,6 +50,11 @@
             "base_url": "https://ark.cn-beijing.volces.com/api/v3",
             "enable_proxy": False,
         },
+        "doubao": {
+            "api_key": "",
+            "base_url": "https://ark.cn-beijing.volces.com/api/coding/v3",
+            "enable_proxy": False,
+        },
         "kling": {
             "base_url": "https://api-beijing.klingai.com",
             "access_key": "",
@@ -58,8 +63,8 @@
         },
     },
     "models": {
-        "llm": "qwen3.5-plus",
-        "vlm": "qwen3.5-plus",
+        "llm": "ark-code-latest",
+        "vlm": "ark-code-latest",
         "image_it2i": "doubao-seedream-5-0-260128",
         "image_t2i": "doubao-seedream-5-0-260128",
         "video": "wan2.7-i2v",
@@ -227,6 +232,9 @@
     ARK_API_KEY = _get(CONFIG, "api_providers.ark.api_key")
     ARK_BASE_URL = _get(CONFIG, "api_providers.ark.base_url")
     ARK_ENABLE_PROXY = _get(CONFIG, "api_providers.ark.enable_proxy")
+    DOUBAO_API_KEY = _get(CONFIG, "api_providers.doubao.api_key")
+    DOUBAO_BASE_URL = _get(CONFIG, "api_providers.doubao.base_url")
+    DOUBAO_ENABLE_PROXY = _get(CONFIG, "api_providers.doubao.enable_proxy")
     KLING_ACCESS_KEY = _get(CONFIG, "api_providers.kling.access_key")
     KLING_SECRET_KEY = _get(CONFIG, "api_providers.kling.secret_key")
     KLING_BASE_URL = _get(CONFIG, "api_providers.kling.base_url")
@@ -302,6 +310,9 @@
         cls.ARK_API_KEY = _get(clean, "api_providers.ark.api_key")
         cls.ARK_BASE_URL = _get(clean, "api_providers.ark.base_url")
         cls.ARK_ENABLE_PROXY = _get(clean, "api_providers.ark.enable_proxy")
+        cls.DOUBAO_API_KEY = _get(clean, "api_providers.doubao.api_key")
+        cls.DOUBAO_BASE_URL = _get(clean, "api_providers.doubao.base_url")
+        cls.DOUBAO_ENABLE_PROXY = _get(clean, "api_providers.doubao.enable_proxy")
         cls.KLING_ACCESS_KEY = _get(clean, "api_providers.kling.access_key")
         cls.KLING_SECRET_KEY = _get(clean, "api_providers.kling.secret_key")
         cls.KLING_BASE_URL = _get(clean, "api_providers.kling.base_url")
diff --git a/video-claw/video-claw/backend/config.yaml.example b/video-claw/video-claw/backend/config.yaml.example
index f1b8dc5..de283ab 100644
--- a/video-claw/video-claw/backend/config.yaml.example
+++ b/video-claw/video-claw/backend/config.yaml.example
@@ -28,14 +28,18 @@
     api_key: ''
     base_url: https://ark.cn-beijing.volces.com/api/v3
     enable_proxy: false
+  doubao:
+    api_key: ''
+    base_url: https://ark.cn-beijing.volces.com/api/coding/v3
+    enable_proxy: false
   kling:
     base_url: https://api-beijing.klingai.com
     access_key: ''
     secret_key: ''
     enable_proxy: false
 models:
-  llm: qwen3.5-plus
-  vlm: qwen3.5-plus
+  llm: ark-code-latest
+  vlm: ark-code-latest
   image_it2i: doubao-seedream-5-0-260128
   image_t2i: doubao-seedream-5-0-260128
   video: wan2.7-i2v
diff --git a/video-claw/video-claw/backend/models/llm_client.py b/video-claw/video-claw/backend/models/llm_client.py
index 1926fde..a6b5512 100644
--- a/video-claw/video-claw/backend/models/llm_client.py
+++ b/video-claw/video-claw/backend/models/llm_client.py
@@ -125,6 +125,14 @@
         model_lower = model.lower()
         if model_lower.startswith("gemini"):
             result = self.gemini_client.query(prompt, image_urls=image_urls, model=model)
+        elif "ep-" in model_lower or "doubao" in model_lower or "ark" in model_lower:
+            # Doubao models via Volcengine ARK
+            if getattr(self, "_doubao_client", None) is None:
+                self._doubao_client = GPT(
+                    base_url=Config.DOUBAO_BASE_URL,
+                    api_key=Config.DOUBAO_API_KEY,
+                )
+            result = self._doubao_client.query(prompt, image_urls=image_urls, model=model, web_search=web_search)
         elif "gpt" in model_lower:
             # OpenAI series models
             result = self.gpt_client.query(prompt, image_urls=image_urls, model=model, web_search=web_search)
diff --git a/video-claw/video-claw/frontend/app/settings/page.tsx b/video-claw/video-claw/frontend/app/settings/page.tsx
index 7639eb8..084f5a2 100644
--- a/video-claw/video-claw/frontend/app/settings/page.tsx
+++ b/video-claw/video-claw/frontend/app/settings/page.tsx
@@ -97,6 +97,15 @@
     ],
   },
   {
+    title: 'Doubao (LLM/VLM)',
+    description: '字节跳动大语言模型及视觉语言模型配置 (例如 ep-xxx 端点)。',
+    fields: [
+      { path: 'api_providers.doubao.api_key', label: 'api_key API 密钥', type: 'password' },
+      { path: 'api_providers.doubao.base_url', label: 'base_url 接口地址' },
+      { path: 'api_providers.doubao.enable_proxy', label: 'enable_proxy 启用代理', type: 'boolean' },
+    ],
+  },
+  {
     title: 'ARK',
     description: 'Seedream / Seedance 使用的火山方舟配置。',
     fields: [

--
Gitblit v1.8.0