hit-cxf
2026-05-14 cd6e29c9d3a49e5b0ea2a8dcbfd0253996ae9a6d
aigc-director/aigc-claw/backend/models/image_client.py
@@ -1,4 +1,12 @@
import os
import sys
models_dir = os.path.dirname(os.path.abspath(__file__))
backend_dir = os.path.dirname(models_dir)
if backend_dir not in sys.path:
    sys.path.insert(0, backend_dir)
import re
import time
import uuid
import logging
@@ -75,7 +83,8 @@
            save_dir: Custom directory to save downloaded images.
            session_id: Session ID for organizing saved files.
            video_ratio: Aspect ratio of the video, e.g., "16:9", "9:16", "4:3", "3:4", "1:1".
            resolution: Resolution string, e.g., "720P", "1080P", "2K", "4K".
            resolution: Resolution string, e.g., "720P", "1080P", "2K", "4K",
                or an exact media-slot size such as "1024*1024".
        Returns:
            List of absolute file paths of the generated images.
@@ -114,8 +123,12 @@
            }
        }
        
        custom_size = None
        if isinstance(resolution, str) and re.match(r"^\d+[x*]\d+$", resolution):
            custom_size = resolution.replace("x", "*")
        # Default fallback if ratio or resolution is not found
        size = size_map.get(video_ratio, size_map["16:9"]).get(resolution, "1920*1080")
        size = custom_size or size_map.get(video_ratio, size_map["16:9"]).get(resolution, "1920*1080")
        if not model:
            model = "wan2.7-image"  # Default model