mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-17 01:52:59 +08:00
fix(seedream4): add flag to ignore error on partial success (#9952)
This commit is contained in:
parent
9fdf8c25ab
commit
852704c81a
@ -567,6 +567,12 @@ class ByteDanceSeedreamNode(comfy_io.ComfyNode):
|
|||||||
tooltip="Whether to add an \"AI generated\" watermark to the image.",
|
tooltip="Whether to add an \"AI generated\" watermark to the image.",
|
||||||
optional=True,
|
optional=True,
|
||||||
),
|
),
|
||||||
|
comfy_io.Boolean.Input(
|
||||||
|
"fail_on_partial",
|
||||||
|
default=True,
|
||||||
|
tooltip="If enabled, abort execution if any requested images are missing or return an error.",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
outputs=[
|
outputs=[
|
||||||
comfy_io.Image.Output(),
|
comfy_io.Image.Output(),
|
||||||
@ -592,6 +598,7 @@ class ByteDanceSeedreamNode(comfy_io.ComfyNode):
|
|||||||
max_images: int = 1,
|
max_images: int = 1,
|
||||||
seed: int = 0,
|
seed: int = 0,
|
||||||
watermark: bool = True,
|
watermark: bool = True,
|
||||||
|
fail_on_partial: bool = True,
|
||||||
) -> comfy_io.NodeOutput:
|
) -> comfy_io.NodeOutput:
|
||||||
validate_string(prompt, strip_whitespace=True, min_length=1)
|
validate_string(prompt, strip_whitespace=True, min_length=1)
|
||||||
w = h = None
|
w = h = None
|
||||||
@ -651,9 +658,10 @@ class ByteDanceSeedreamNode(comfy_io.ComfyNode):
|
|||||||
|
|
||||||
if len(response.data) == 1:
|
if len(response.data) == 1:
|
||||||
return comfy_io.NodeOutput(await download_url_to_image_tensor(get_image_url_from_response(response)))
|
return comfy_io.NodeOutput(await download_url_to_image_tensor(get_image_url_from_response(response)))
|
||||||
return comfy_io.NodeOutput(
|
urls = [str(d["url"]) for d in response.data if isinstance(d, dict) and "url" in d]
|
||||||
torch.cat([await download_url_to_image_tensor(str(i["url"])) for i in response.data])
|
if fail_on_partial and len(urls) < len(response.data):
|
||||||
)
|
raise RuntimeError(f"Only {len(urls)} of {len(response.data)} images were generated before error.")
|
||||||
|
return comfy_io.NodeOutput(torch.cat([await download_url_to_image_tensor(i) for i in urls]))
|
||||||
|
|
||||||
|
|
||||||
class ByteDanceTextToVideoNode(comfy_io.ComfyNode):
|
class ByteDanceTextToVideoNode(comfy_io.ComfyNode):
|
||||||
@ -1171,7 +1179,7 @@ async def process_video_task(
|
|||||||
payload: Union[Text2VideoTaskCreationRequest, Image2VideoTaskCreationRequest],
|
payload: Union[Text2VideoTaskCreationRequest, Image2VideoTaskCreationRequest],
|
||||||
auth_kwargs: dict,
|
auth_kwargs: dict,
|
||||||
node_id: str,
|
node_id: str,
|
||||||
estimated_duration: int | None,
|
estimated_duration: Optional[int],
|
||||||
) -> comfy_io.NodeOutput:
|
) -> comfy_io.NodeOutput:
|
||||||
initial_response = await SynchronousOperation(
|
initial_response = await SynchronousOperation(
|
||||||
endpoint=ApiEndpoint(
|
endpoint=ApiEndpoint(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user