fix: 模型选择读取客户选项+定价改为llmage模型(wan2.6/happyhorse/kling)
This commit is contained in:
parent
3493444307
commit
225c654811
@ -19,33 +19,33 @@ from typing import List, Dict, Any
|
||||
logger = logging.getLogger("pipeline.cost_estimator")
|
||||
|
||||
|
||||
# Model pricing configuration (USD per frame at 24fps)
|
||||
# Model pricing configuration — llmage v1 video models
|
||||
MODEL_PRICING = {
|
||||
"wan2.2": {
|
||||
"name": "Wan 2.2 (Local GPU)",
|
||||
"price_per_frame": 0.002, # $0.002 per frame
|
||||
"quality_score": 7.5,
|
||||
"generation_speed": "fast",
|
||||
"description": "Fast generation, good quality, cost-effective",
|
||||
"features": ["T2V", "Ref2V"],
|
||||
"recommended_for": ["standard", "batch"],
|
||||
},
|
||||
"wan2.7": {
|
||||
"name": "Wan 2.7 (Local GPU)",
|
||||
"price_per_frame": 0.003, # $0.003 per frame
|
||||
"wan2.6-t2v": {
|
||||
"name": "通义万象 WAN 2.6 (T2V)",
|
||||
"price_per_second": 0.05,
|
||||
"quality_score": 8.5,
|
||||
"generation_speed": "medium",
|
||||
"description": "Higher quality, balanced performance",
|
||||
"features": ["T2V", "Ref2V", "I2V"],
|
||||
"description": "高质量文生视频,支持5-15秒",
|
||||
"features": ["T2V"],
|
||||
"recommended_for": ["quality", "professional"],
|
||||
},
|
||||
"vidu2.0": {
|
||||
"name": "Vidu 2.0 (Cloud API)",
|
||||
"price_per_frame": 0.008, # $0.008 per frame
|
||||
"happyhorse-1.0-t2v": {
|
||||
"name": "快乐马 HappyHorse 1.0 (T2V)",
|
||||
"price_per_second": 0.03,
|
||||
"quality_score": 7.5,
|
||||
"generation_speed": "fast",
|
||||
"description": "快速文生视频,经济实惠",
|
||||
"features": ["T2V", "I2V"],
|
||||
"recommended_for": ["standard", "batch"],
|
||||
},
|
||||
"kling-v2-1-master": {
|
||||
"name": "可灵 Kling 2.1 Master (T2V)",
|
||||
"price_per_second": 0.10,
|
||||
"quality_score": 9.0,
|
||||
"generation_speed": "slow",
|
||||
"description": "Highest quality, premium pricing",
|
||||
"features": ["T2V", "I2V", "V2V"],
|
||||
"description": "旗舰级文生视频,最高质量",
|
||||
"features": ["T2V", "I2V"],
|
||||
"recommended_for": ["premium", "cinematic"],
|
||||
},
|
||||
}
|
||||
|
||||
@ -601,33 +601,32 @@ async def handle_storyboard_generating(tenant_id, task_id, step_name, input_data
|
||||
|
||||
|
||||
async def handle_scene_video_generating(tenant_id, task_id, step_name, input_data, config):
|
||||
"""通过 /v1/video/generations 生成场景视频。"""
|
||||
"""通过 /v1/video/generations 生成场景视频,模型由客户选择。"""
|
||||
work_dir = _task_dir(task_id)
|
||||
storyboard = None
|
||||
char_images = None
|
||||
selected_model = "wan2.6-t2v" # 默认
|
||||
for dep_output in input_data.values():
|
||||
if isinstance(dep_output, dict):
|
||||
if dep_output.get("storyboard"): storyboard = dep_output["storyboard"]
|
||||
if dep_output.get("character_images"): char_images = dep_output["character_images"]
|
||||
|
||||
if dep_output.get("selected_model"): selected_model = dep_output["selected_model"]
|
||||
if not storyboard:
|
||||
raise ValueError("上游步骤未提供分镜脚本")
|
||||
|
||||
logger.info(f"Using model: {selected_model}")
|
||||
client = get_ktv_client()
|
||||
await client._ensure_session()
|
||||
scene_videos = []
|
||||
|
||||
for i, scene in enumerate(storyboard):
|
||||
desc = scene.get("description", "")
|
||||
duration = scene.get("end_time", 10) - scene.get("start_time", 5)
|
||||
duration = int(scene.get("end_time", 10) - scene.get("start_time", 5))
|
||||
|
||||
body = {"model": "wan2.6-t2v", "catelogid": "t2v",
|
||||
"prompt": desc, "duration": str(int(duration))}
|
||||
body = {"model": selected_model, "catelogid": "t2v",
|
||||
"prompt": desc, "duration": str(duration)}
|
||||
url = f"{client.base}/video/generations"
|
||||
async with client._session.post(url, json=body) as resp:
|
||||
data = await resp.json()
|
||||
|
||||
# 视频生成是异步的
|
||||
taskid = data.get("taskid", "")
|
||||
if taskid:
|
||||
data = await client._poll(taskid)
|
||||
@ -637,12 +636,11 @@ async def handle_scene_video_generating(tenant_id, task_id, step_name, input_dat
|
||||
if video_url:
|
||||
await _download(video_url, local_scene)
|
||||
|
||||
scene_videos.append({"scene_id": scene.get("scene_id", i),
|
||||
"video_path": local_scene, "description": desc,
|
||||
"duration": duration})
|
||||
scene_videos.append({"scene_id": i, "video_path": local_scene,
|
||||
"description": desc, "duration": duration})
|
||||
|
||||
return {"scene_videos": scene_videos, "scene_count": len(scene_videos),
|
||||
"selected_model": "wan2.6-t2v"}
|
||||
"selected_model": selected_model}
|
||||
|
||||
|
||||
async def handle_scene_video_evaluating(tenant_id, task_id, step_name, input_data, config):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user