From 323d3e88bce56614dee63428c986fc325afa64d9 Mon Sep 17 00:00:00 2001
From: log
Date: Tue, 23 Jun 2026 19:46:41 +0800
Subject: [PATCH] refactor: dynamically inject Seedream EP from config instead of hardcoding

---
 video-claw/video-claw/backend/models/config_model.py |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/video-claw/video-claw/backend/models/config_model.py b/video-claw/video-claw/backend/models/config_model.py
index 9429a45..f2b3171 100644
--- a/video-claw/video-claw/backend/models/config_model.py
+++ b/video-claw/video-claw/backend/models/config_model.py
@@ -212,25 +212,7 @@
                                                             'api_contract_verified': True,
                                                             'resolutions': ['720P', '1080P', '2K', '4K'],
                                                             'ratios': ['16:9', '9:16', '1:1', '4:3', '3:4']}},
-            'ep-20260510144546-hwrtr': {'name': 'Seedream 5.0 (EP)',
-                                           'provider': 'ark',
-                                           'family': 'seedream',
-                                           'type': ['t2i', 'i2i'],
-                                           'concurrency': 10,
-                                           'price_per_image': 0.22,
-                                           'capabilities': {'ability_type': 'image_generation',
-                                                            'ability_types': ['text_to_image',
-                                                                              'image_to_image',
-                                                                              'reference_image',
-                                                                              'high_quality'],
-                                                            'adapter_ability_types': ['text_to_image',
-                                                                                      'image_to_image',
-                                                                                      'reference_image'],
-                                                            'input_modalities': ['text', 'image'],
-                                                            'adapter_input_modalities': ['text', 'image'],
-                                                            'api_contract_verified': True,
-                                                            'resolutions': ['720P', '1080P', '2K', '4K'],
-                                                            'ratios': ['16:9', '9:16', '1:1', '4:3', '3:4']}},
+
             'doubao-seedream-4-5-251128': {'name': 'Seedream 4.5',
                                            'provider': 'ark',
                                            'family': 'seedream',
@@ -734,3 +716,35 @@
     if any(item in types for item in ("t2i", "i2i", "image")):
         return "image"
     return ""
+
+from config import Config
+
+def _inject_custom_endpoints():
+    eps = set()
+    if Config.IMAGE_IT2I_MODEL and Config.IMAGE_IT2I_MODEL.startswith("ep-"):
+        eps.add(Config.IMAGE_IT2I_MODEL)
+    if Config.IMAGE_T2I_MODEL and Config.IMAGE_T2I_MODEL.startswith("ep-"):
+        eps.add(Config.IMAGE_T2I_MODEL)
+    
+    for ep in eps:
+        if ep not in MODEL_CONFIG['models']:
+            MODEL_CONFIG['models'][ep] = {
+                'name': f'Seedream Custom EP ({ep[-5:]})',
+                'provider': 'ark',
+                'family': 'seedream',
+                'type': ['t2i', 'i2i'],
+                'concurrency': 10,
+                'price_per_image': 0.22,
+                'capabilities': {
+                    'ability_type': 'image_generation',
+                    'ability_types': ['text_to_image', 'image_to_image', 'reference_image', 'high_quality'],
+                    'adapter_ability_types': ['text_to_image', 'image_to_image', 'reference_image'],
+                    'input_modalities': ['text', 'image'],
+                    'adapter_input_modalities': ['text', 'image'],
+                    'api_contract_verified': True,
+                    'resolutions': ['720P', '1080P', '2K', '4K'],
+                    'ratios': ['16:9', '9:16', '1:1', '4:3', '3:4']
+                }
+            }
+
+_inject_custom_endpoints()

--
Gitblit v1.8.0