Skip to content

Commit d4b038d

Browse files
letherkevinlin09
authored andcommitted
wan26_Default_value_modificationtions_and_Fix_name_too_long_error
1 parent 3d6a2ef commit d4b038d

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

src/agentscope_bricks/components/generations/async_image_to_video_fl_wan22.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,15 @@ class ImageToVideoByFirstAndLastFrameWan22Submit(
9595
task using the wan2.2-kf2v-flash model.
9696
"""
9797

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

106104
@trace(
107105
trace_type="AIGC",
108-
trace_name="image_to_video_by_first_and_last_frame_wan22_submit",
106+
trace_name="image_to_video_fl_wan22_submit_task",
109107
)
110108
async def arun(
111109
self,
@@ -226,9 +224,7 @@ class ImageToVideoByFirstAndLastFrameWan22Fetch(
226224
ImageToVideoByFirstAndLastFrameWan22FetchOutput,
227225
],
228226
):
229-
name: str = (
230-
"modelstudio_image_to_video_by_first_and_last_frame_wan22_fetch_result"
231-
)
227+
name: str = "modelstudio_image_to_video_fl_wan22_fetch_result"
232228
description: str = (
233229
"查询通义万相 wan2.2-kf2v-flash 首尾帧生视频任务的结果。\n"
234230
"输入 Task ID,返回生成的视频 URL 及任务状态。\n"
@@ -238,7 +234,7 @@ class ImageToVideoByFirstAndLastFrameWan22Fetch(
238234

239235
@trace(
240236
trace_type="AIGC",
241-
trace_name="image_to_video_by_first_and_last_frame_wan22_fetch",
237+
trace_name="image_to_video_fl_wan22_fetch",
242238
)
243239
async def arun(
244240
self,

src/agentscope_bricks/components/generations/image_edit_wan26.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class ImageGenInput(BaseModel):
4141
description="是否添加水印,false:默认值,不添加水印,true:添加水印。",
4242
)
4343
n: Optional[int] = Field(
44-
default=4,
45-
description="生成图片的数量。取值范围为1~4张 默认4",
44+
default=1,
45+
description="生成图片的数量。取值范围为1~4张 默认1",
4646
)
4747
images: list[str] = Field(
4848
...,
@@ -104,10 +104,8 @@ async def arun(
104104
raise ValueError("Please set valid DASHSCOPE_API_KEY!")
105105

106106
model_name = "wan2.6-image"
107-
108-
# 构造多模态 content:文本 + 可选图像
109107
content = [{"text": args.prompt}]
110-
images = args.images or [] # 安全处理 None
108+
images = args.images or []
111109
for img_url in images:
112110
content.append({"image": img_url})
113111

@@ -120,15 +118,15 @@ async def arun(
120118
parameters = {}
121119
if args.negative_prompt:
122120
parameters["negative_prompt"] = args.negative_prompt
123-
if args.size and args.size != "1280*1280":
121+
if args.size:
124122
parameters["size"] = args.size
125123
if args.seed is not None:
126124
parameters["seed"] = args.seed
127125
if args.watermark is not None:
128126
parameters["watermark"] = args.watermark
129127
if args.prompt_extend is not None:
130128
parameters["prompt_extend"] = args.prompt_extend
131-
if args.n is not None and args.n != 4:
129+
if args.n is not None:
132130
parameters["n"] = args.n
133131
try:
134132
response = await AioMultiModalConversation.call(
@@ -156,7 +154,6 @@ async def arun(
156154
message = getattr(choice, "message", {})
157155
msg_content = getattr(message, "content", [])
158156
if isinstance(msg_content, list):
159-
# 遍历当前 choice 的 content
160157
for item in msg_content:
161158
if isinstance(item, dict) and "image" in item:
162159
results.append(item["image"])
@@ -176,7 +173,6 @@ async def arun(
176173
and "image" in msg_content
177174
):
178175
results.append(msg_content["image"])
179-
# --- 修改结束 ---
180176
except Exception as e:
181177
raise RuntimeError(
182178
f"Failed to parse Wanx 2.6 API response: {str(e)}",

src/agentscope_bricks/components/generations/image_generation_wan26.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ async def arun(
120120
parameters = {}
121121
if args.negative_prompt:
122122
parameters["negative_prompt"] = args.negative_prompt
123-
if args.size and args.size != "1024*1024":
123+
if args.size:
124124
parameters["size"] = args.size
125-
if args.n is not None and args.n != 1:
125+
if args.n is not None:
126126
parameters["n"] = args.n
127127
if args.seed is not None:
128128
parameters["seed"] = args.seed
@@ -150,7 +150,7 @@ async def arun(
150150
try:
151151
if hasattr(response, "output") and response.output:
152152
choices = getattr(response.output, "choices", [])
153-
for choice in choices: # ← 遍历所有 choices,而不是只取 [0]
153+
for choice in choices:
154154
message = getattr(choice, "message", {})
155155
content = getattr(message, "content", [])
156156
if isinstance(content, list):

0 commit comments

Comments
 (0)