| | |
| | | base_prompt = self._setting_prompt(name, desc, style) |
| | | |
| | | video_ratio = "16:9" |
| | | resolution = "4K" |
| | | resolution = "2K" |
| | | current_prompt = base_prompt |
| | | |
| | | for iteration in range(max_iterations): |
| | |
| | | def _evaluate_with_vlm(self, image_path: str, description: str, asset_type: str, vlm_model: str = "qwen3.5-plus") -> dict: |
| | | """使用 VLM 评估生成的图片""" |
| | | try: |
| | | from tool.vlm_client import VLM |
| | | from models.vlm_client import VLM |
| | | vlm = VLM() |
| | | |
| | | # 选择评估提示词 |
| | |
| | | def _select_best_with_vlm(self, image_paths: List[str], name: str, description: str, |
| | | asset_type: str, species: str = "", vlm_model: str = "qwen3.5-plus") -> tuple: |
| | | """使用 VLM 从多个版本中选择最好的一张""" |
| | | from tool.vlm_client import VLM |
| | | from models.vlm_client import VLM |
| | | import re |
| | | |
| | | if not image_paths: |
| | |
| | | |
| | | async def process(self, input_data: Any, intervention: Optional[Dict] = None) -> Dict: |
| | | from config import settings |
| | | from tool.image_client import ImageClient |
| | | from models.image_client import ImageClient |
| | | |
| | | sid = input_data["session_id"] |
| | | style = input_data.get("style", "anime") |
| | | t2i_model = input_data.get("image_t2i_model", "") or settings.IMAGE_T2I_MODEL |
| | | vlm_model = input_data.get("vlm_model", "qwen3.5-plus") |
| | | t2i_model = self._require_input(input_data, "image_t2i_model") |
| | | vlm_model = self._require_input(input_data, "vlm_model") |
| | | # 根据 enable_concurrency 决定并发数 |
| | | enable_concurrency = input_data.get("enable_concurrency", True) |
| | | logger.info(f"[CharacterAgent] enable_concurrency={enable_concurrency}") |
| | | from config_model import get_max_concurrency |
| | | from models.config_model import get_max_concurrency |
| | | max_concurrency = get_max_concurrency(t2i_model, enable_concurrency) |
| | | logger.info(f"[CharacterAgent] 使用并发数={max_concurrency}") |
| | | concurrency = max_concurrency |
| | |
| | | img_client = ImageClient( |
| | | dashscope_api_key=settings.DASHSCOPE_API_KEY, |
| | | dashscope_base_url=settings.DASHSCOPE_BASE_URL, |
| | | gpt_api_key=os.getenv("OPENAI_API_KEY"), |
| | | gpt_base_url=os.getenv("OPENAI_BASE_URL"), |
| | | gpt_official_api_key=settings.OPENAI_OFFICIAL_API_KEY, |
| | | local_proxy=settings.LOCAL_PROXY, |
| | | gpt_api_key=settings.OPENAI_API_KEY, |
| | | gpt_base_url=settings.OPENAI_BASE_URL, |
| | | proxy=settings.provider_proxy("openai"), |
| | | ark_api_key=settings.ARK_API_KEY, |
| | | ark_base_url=settings.ARK_BASE_URL, |
| | | ) |