| | |
| | | character_description: str = "", setting_description: str = "", |
| | | vlm_model: str = "qwen3.5-plus") -> tuple: |
| | | """使用 VLM 从多个版本中选择最好的一张""" |
| | | from tool.vlm_client import VLM |
| | | from models.vlm_client import VLM |
| | | |
| | | if not image_paths: |
| | | return None, None |
| | |
| | | vlm_model: str = "qwen3.5-plus") -> dict: |
| | | """使用 VLM 评估首帧参考图""" |
| | | try: |
| | | from tool.vlm_client import VLM |
| | | from models.vlm_client import VLM |
| | | vlm = VLM() |
| | | |
| | | eval_prompt = load_prompt('reference', 'eval_first_frame', 'zh').format( |
| | |
| | | |
| | | async def process(self, input_data: Any, intervention: Optional[Dict] = None) -> Dict: |
| | | from config import settings |
| | | from tool.image_client import ImageClient |
| | | from tool.llm_client import LLM |
| | | from models.image_client import ImageClient |
| | | from models.llm_client import LLM |
| | | |
| | | # 从 session.json 补齐缺失的参数(关键修复:防止前端漏传导致的默认值回退) |
| | | input_data = self._merge_session_params(input_data) |
| | |
| | | style = input_data.get("style", "anime") |
| | | video_ratio = input_data.get("video_ratio", "16:9") |
| | | resolution = input_data.get("resolution", "2K") |
| | | llm_model = input_data.get("llm_model", "") or settings.LLM_MODEL |
| | | t2i = input_data.get("image_t2i_model", "") or settings.IMAGE_T2I_MODEL |
| | | it2i = input_data.get("image_it2i_model", "") or settings.IMAGE_IT2I_MODEL |
| | | vlm_model = input_data.get("vlm_model", "") or settings.VLM_MODEL |
| | | llm_model = self._require_input(input_data, "llm_model") |
| | | t2i = self._require_input(input_data, "image_t2i_model") |
| | | it2i = self._require_input(input_data, "image_it2i_model") |
| | | vlm_model = self._require_input(input_data, "vlm_model") |
| | | # 根据 enable_concurrency 决定并发数 |
| | | enable_concurrency = input_data.get("enable_concurrency", True) |
| | | logger.info(f"[ReferenceAgent] enable_concurrency={enable_concurrency}") |
| | | # 取 t2i 和 it2i 中的最大并发数 |
| | | from config_model import get_max_concurrency |
| | | from models.config_model import get_max_concurrency |
| | | max_t2i = get_max_concurrency(t2i, enable_concurrency) |
| | | max_it2i = get_max_concurrency(it2i, enable_concurrency) |
| | | concurrency = max(max_t2i, max_it2i) |
| | |
| | | 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"), |
| | | 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, |
| | | ) |