Skip to content

Commit a2b60de

Browse files
committed
dev: allow set asset name
Signed-off-by: bigcat88 <bigcat88@icloud.com>
1 parent 7288264 commit a2b60de

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

comfy_api_nodes/nodes_bytedance.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,18 @@ def _seedance_group_name_input() -> IO.String.Input:
19841984
)
19851985

19861986

1987+
def _seedance_asset_name_input() -> IO.String.Input:
1988+
return IO.String.Input(
1989+
"asset_name",
1990+
default="",
1991+
tooltip=(
1992+
"Optional label for the asset, shown in the asset selector dropdown. "
1993+
"Up to 64 characters. Leave empty to identify the asset by its id."
1994+
),
1995+
optional=True,
1996+
)
1997+
1998+
19871999
class ByteDanceCreateImageAsset(IO.ComfyNode):
19882000

19892001
@classmethod
@@ -2002,6 +2014,7 @@ def define_schema(cls) -> IO.Schema:
20022014
IO.Image.Input("image", tooltip="Image to register as a personal asset."),
20032015
_seedance_group_picker_input(),
20042016
_seedance_group_name_input(),
2017+
_seedance_asset_name_input(),
20052018
],
20062019
outputs=[
20072020
IO.String.Output(display_name="asset_id"),
@@ -2021,6 +2034,7 @@ async def execute(
20212034
image: Input.Image,
20222035
group_id: str = "",
20232036
group_name: str = "",
2037+
asset_name: str = "",
20242038
) -> IO.NodeOutput:
20252039
validate_image_dimensions(image, min_width=300, max_width=6000, min_height=300, max_height=6000)
20262040
validate_image_aspect_ratio(image, min_ratio=(0.4, 1), max_ratio=(2.5, 1))
@@ -2029,7 +2043,7 @@ async def execute(
20292043
cls,
20302044
group_id=resolved_group,
20312045
url=await upload_image_to_comfyapi(cls, image),
2032-
name="",
2046+
name=asset_name.strip()[:64],
20332047
asset_type="Image",
20342048
)
20352049
await _wait_for_asset_active(cls, asset_id, resolved_group)
@@ -2059,6 +2073,7 @@ def define_schema(cls) -> IO.Schema:
20592073
IO.Video.Input("video", tooltip="Video to register as a personal asset."),
20602074
_seedance_group_picker_input(),
20612075
_seedance_group_name_input(),
2076+
_seedance_asset_name_input(),
20622077
],
20632078
outputs=[
20642079
IO.String.Output(display_name="asset_id"),
@@ -2078,6 +2093,7 @@ async def execute(
20782093
video: Input.Video,
20792094
group_id: str = "",
20802095
group_name: str = "",
2096+
asset_name: str = "",
20812097
) -> IO.NodeOutput:
20822098
validate_video_duration(video, min_duration=2, max_duration=15)
20832099
validate_video_dimensions(video, min_width=300, max_width=6000, min_height=300, max_height=6000)
@@ -2102,7 +2118,7 @@ async def execute(
21022118
cls,
21032119
group_id=resolved_group,
21042120
url=await upload_video_to_comfyapi(cls, video),
2105-
name="",
2121+
name=asset_name.strip()[:64],
21062122
asset_type="Video",
21072123
)
21082124
await _wait_for_asset_active(cls, asset_id, resolved_group)

0 commit comments

Comments
 (0)