Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,15 @@ class ImageToVideoByFirstAndLastFrameWan22Submit(
task using the wan2.2-kf2v-flash model.
"""

name: str = (
"modelstudio_image_to_video_by_first_and_last_frame_wan22_submit_task"
)
name: str = "modelstudio_image_to_video_fl_wan22_submit_task"
description: str = (
"[版本: wan2.2] 通义万相首尾帧生视频模型(wan2.2-kf2v-flash)异步任务提交工具。\n"
"基于首帧与尾帧图像及文本提示,生成一段流畅的无声视频(当前不支持音频输出)。\n"
)

@trace(
trace_type="AIGC",
trace_name="image_to_video_by_first_and_last_frame_wan22_submit",
trace_name="image_to_video_fl_wan22_submit_task",
)
async def arun(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ImageGenInput(BaseModel):
description="是否添加水印,false:默认值,不添加水印,true:添加水印。",
)
n: Optional[int] = Field(
default=4,
description="生成图片的数量。取值范围为1~4张 默认4",
default=1,
description="生成图片的数量。取值范围为1~4张 默认1",
)
images: list[str] = Field(
...,
Expand Down Expand Up @@ -128,7 +128,7 @@ async def arun(
parameters["watermark"] = args.watermark
if args.prompt_extend is not None:
parameters["prompt_extend"] = args.prompt_extend
if args.n is not None and args.n != 4:
if args.n is not None:
parameters["n"] = args.n
try:
response = await AioMultiModalConversation.call(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ImageGenerationWan26(

name: str = "modelstudio_wanx26_image_generation"
description: str = (
"[版本: wan2.6] 通义万相文生图模型(wanx2.6-t2i)。AI绘画服务,根据文本描述生成高质量图像,并返回图片URL。\n"
"[版本: wan2.6] 通义万相文生图模型(wan2.6-t2i)。AI绘画服务,根据文本描述生成高质量图像,并返回图片URL。\n"
"新功能包括图像编辑和图文混合输出,满足更多样化的生成与集成需求。\n"
"支持自定义分辨率:图像面积介于 768×768 至 1440×1440 像素之间,"
"允许在该范围内自由调整宽高比(例如 768×2700)。\n"
Expand Down Expand Up @@ -122,7 +122,7 @@ async def arun(
parameters["negative_prompt"] = args.negative_prompt
if args.size and args.size != "1024*1024":
parameters["size"] = args.size
if args.n is not None and args.n != 1:
if args.n is not None:
parameters["n"] = args.n
if args.seed is not None:
parameters["seed"] = args.seed
Expand All @@ -140,18 +140,18 @@ async def arun(
)
except Exception as e:
raise RuntimeError(
f"Failed to call Wanx 2.6 image generation API: {str(e)}",
f"Failed to call Wan 2.6 image generation API: {str(e)}",
) from e

if response.status_code != 200 or not response.output:
raise RuntimeError(f"Wanx 2.6 image generation failed: {response}")
raise RuntimeError(f"Wan 2.6 image generation failed: {response}")

results = []
try:
if hasattr(response, "output") and response.output:
choices = getattr(response.output, "choices", [])
if choices:
message = getattr(choices[0], "message", {})
for choice in choices: # ← 遍历所有 choices,而不是只取 [0]
message = getattr(choice, "message", {})
content = getattr(message, "content", [])
if isinstance(content, list):
for item in content:
Expand All @@ -163,7 +163,7 @@ async def arun(
results.append(content["image"])
except Exception as e:
raise RuntimeError(
f"Failed to parse Wanx 2.6 API response: {str(e)}",
f"Failed to parse Wan 2.6 API response: {str(e)}",
) from e

if not results:
Expand Down