mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-20 15:32:32 +08:00
Merge branch 'Comfy-Org:master' into master
This commit is contained in:
commit
6d4f9e86ab
@ -35,4 +35,4 @@ def te(dtype_llama=None, llama_quantization_metadata=None):
|
|||||||
model_options = model_options.copy()
|
model_options = model_options.copy()
|
||||||
model_options["quantization_metadata"] = llama_quantization_metadata
|
model_options["quantization_metadata"] = llama_quantization_metadata
|
||||||
super().__init__(device=device, dtype=dtype, model_options=model_options)
|
super().__init__(device=device, dtype=dtype, model_options=model_options)
|
||||||
return ErnieTEModel
|
return ErnieTEModel_
|
||||||
|
|||||||
@ -1066,7 +1066,7 @@ PRICE_BADGE_VIDEO = IO.PriceBadge(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _seedance2_text_inputs():
|
def _seedance2_text_inputs(resolutions: list[str]):
|
||||||
return [
|
return [
|
||||||
IO.String.Input(
|
IO.String.Input(
|
||||||
"prompt",
|
"prompt",
|
||||||
@ -1076,7 +1076,7 @@ def _seedance2_text_inputs():
|
|||||||
),
|
),
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"resolution",
|
"resolution",
|
||||||
options=["480p", "720p"],
|
options=resolutions,
|
||||||
tooltip="Resolution of the output video.",
|
tooltip="Resolution of the output video.",
|
||||||
),
|
),
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
@ -1114,8 +1114,8 @@ class ByteDance2TextToVideoNode(IO.ComfyNode):
|
|||||||
IO.DynamicCombo.Input(
|
IO.DynamicCombo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=[
|
options=[
|
||||||
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_text_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_text_inputs(["480p", "720p", "1080p"])),
|
||||||
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_text_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_text_inputs(["480p", "720p"])),
|
||||||
],
|
],
|
||||||
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
||||||
),
|
),
|
||||||
@ -1152,11 +1152,14 @@ class ByteDance2TextToVideoNode(IO.ComfyNode):
|
|||||||
(
|
(
|
||||||
$rate480 := 10044;
|
$rate480 := 10044;
|
||||||
$rate720 := 21600;
|
$rate720 := 21600;
|
||||||
|
$rate1080 := 48800;
|
||||||
$m := widgets.model;
|
$m := widgets.model;
|
||||||
$pricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
$pricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
||||||
$res := $lookup(widgets, "model.resolution");
|
$res := $lookup(widgets, "model.resolution");
|
||||||
$dur := $lookup(widgets, "model.duration");
|
$dur := $lookup(widgets, "model.duration");
|
||||||
$rate := $res = "720p" ? $rate720 : $rate480;
|
$rate := $res = "1080p" ? $rate1080 :
|
||||||
|
$res = "720p" ? $rate720 :
|
||||||
|
$rate480;
|
||||||
$cost := $dur * $rate * $pricePer1K / 1000;
|
$cost := $dur * $rate * $pricePer1K / 1000;
|
||||||
{"type": "usd", "usd": $cost, "format": {"approximate": true}}
|
{"type": "usd", "usd": $cost, "format": {"approximate": true}}
|
||||||
)
|
)
|
||||||
@ -1195,6 +1198,7 @@ class ByteDance2TextToVideoNode(IO.ComfyNode):
|
|||||||
status_extractor=lambda r: r.status,
|
status_extractor=lambda r: r.status,
|
||||||
price_extractor=_seedance2_price_extractor(model_id, has_video_input=False),
|
price_extractor=_seedance2_price_extractor(model_id, has_video_input=False),
|
||||||
poll_interval=9,
|
poll_interval=9,
|
||||||
|
max_poll_attempts=180,
|
||||||
)
|
)
|
||||||
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
||||||
|
|
||||||
@ -1212,8 +1216,8 @@ class ByteDance2FirstLastFrameNode(IO.ComfyNode):
|
|||||||
IO.DynamicCombo.Input(
|
IO.DynamicCombo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=[
|
options=[
|
||||||
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_text_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_text_inputs(["480p", "720p", "1080p"])),
|
||||||
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_text_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_text_inputs(["480p", "720p"])),
|
||||||
],
|
],
|
||||||
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
||||||
),
|
),
|
||||||
@ -1259,11 +1263,14 @@ class ByteDance2FirstLastFrameNode(IO.ComfyNode):
|
|||||||
(
|
(
|
||||||
$rate480 := 10044;
|
$rate480 := 10044;
|
||||||
$rate720 := 21600;
|
$rate720 := 21600;
|
||||||
|
$rate1080 := 48800;
|
||||||
$m := widgets.model;
|
$m := widgets.model;
|
||||||
$pricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
$pricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
||||||
$res := $lookup(widgets, "model.resolution");
|
$res := $lookup(widgets, "model.resolution");
|
||||||
$dur := $lookup(widgets, "model.duration");
|
$dur := $lookup(widgets, "model.duration");
|
||||||
$rate := $res = "720p" ? $rate720 : $rate480;
|
$rate := $res = "1080p" ? $rate1080 :
|
||||||
|
$res = "720p" ? $rate720 :
|
||||||
|
$rate480;
|
||||||
$cost := $dur * $rate * $pricePer1K / 1000;
|
$cost := $dur * $rate * $pricePer1K / 1000;
|
||||||
{"type": "usd", "usd": $cost, "format": {"approximate": true}}
|
{"type": "usd", "usd": $cost, "format": {"approximate": true}}
|
||||||
)
|
)
|
||||||
@ -1324,13 +1331,14 @@ class ByteDance2FirstLastFrameNode(IO.ComfyNode):
|
|||||||
status_extractor=lambda r: r.status,
|
status_extractor=lambda r: r.status,
|
||||||
price_extractor=_seedance2_price_extractor(model_id, has_video_input=False),
|
price_extractor=_seedance2_price_extractor(model_id, has_video_input=False),
|
||||||
poll_interval=9,
|
poll_interval=9,
|
||||||
|
max_poll_attempts=180,
|
||||||
)
|
)
|
||||||
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
||||||
|
|
||||||
|
|
||||||
def _seedance2_reference_inputs():
|
def _seedance2_reference_inputs(resolutions: list[str]):
|
||||||
return [
|
return [
|
||||||
*_seedance2_text_inputs(),
|
*_seedance2_text_inputs(resolutions),
|
||||||
IO.Autogrow.Input(
|
IO.Autogrow.Input(
|
||||||
"reference_images",
|
"reference_images",
|
||||||
template=IO.Autogrow.TemplateNames(
|
template=IO.Autogrow.TemplateNames(
|
||||||
@ -1382,8 +1390,8 @@ class ByteDance2ReferenceNode(IO.ComfyNode):
|
|||||||
IO.DynamicCombo.Input(
|
IO.DynamicCombo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=[
|
options=[
|
||||||
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_reference_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0", _seedance2_reference_inputs(["480p", "720p", "1080p"])),
|
||||||
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_reference_inputs()),
|
IO.DynamicCombo.Option("Seedance 2.0 Fast", _seedance2_reference_inputs(["480p", "720p"])),
|
||||||
],
|
],
|
||||||
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
tooltip="Seedance 2.0 for maximum quality; Seedance 2.0 Fast for speed optimization.",
|
||||||
),
|
),
|
||||||
@ -1423,13 +1431,16 @@ class ByteDance2ReferenceNode(IO.ComfyNode):
|
|||||||
(
|
(
|
||||||
$rate480 := 10044;
|
$rate480 := 10044;
|
||||||
$rate720 := 21600;
|
$rate720 := 21600;
|
||||||
|
$rate1080 := 48800;
|
||||||
$m := widgets.model;
|
$m := widgets.model;
|
||||||
$hasVideo := $lookup(inputGroups, "model.reference_videos") > 0;
|
$hasVideo := $lookup(inputGroups, "model.reference_videos") > 0;
|
||||||
$noVideoPricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
$noVideoPricePer1K := $contains($m, "fast") ? 0.008008 : 0.01001;
|
||||||
$videoPricePer1K := $contains($m, "fast") ? 0.004719 : 0.006149;
|
$videoPricePer1K := $contains($m, "fast") ? 0.004719 : 0.006149;
|
||||||
$res := $lookup(widgets, "model.resolution");
|
$res := $lookup(widgets, "model.resolution");
|
||||||
$dur := $lookup(widgets, "model.duration");
|
$dur := $lookup(widgets, "model.duration");
|
||||||
$rate := $res = "720p" ? $rate720 : $rate480;
|
$rate := $res = "1080p" ? $rate1080 :
|
||||||
|
$res = "720p" ? $rate720 :
|
||||||
|
$rate480;
|
||||||
$noVideoCost := $dur * $rate * $noVideoPricePer1K / 1000;
|
$noVideoCost := $dur * $rate * $noVideoPricePer1K / 1000;
|
||||||
$minVideoFactor := $ceil($dur * 5 / 3);
|
$minVideoFactor := $ceil($dur * 5 / 3);
|
||||||
$minVideoCost := $minVideoFactor * $rate * $videoPricePer1K / 1000;
|
$minVideoCost := $minVideoFactor * $rate * $videoPricePer1K / 1000;
|
||||||
@ -1559,6 +1570,7 @@ class ByteDance2ReferenceNode(IO.ComfyNode):
|
|||||||
status_extractor=lambda r: r.status,
|
status_extractor=lambda r: r.status,
|
||||||
price_extractor=_seedance2_price_extractor(model_id, has_video_input=has_video_input),
|
price_extractor=_seedance2_price_extractor(model_id, has_video_input=has_video_input),
|
||||||
poll_interval=9,
|
poll_interval=9,
|
||||||
|
max_poll_attempts=180,
|
||||||
)
|
)
|
||||||
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
return IO.NodeOutput(await download_url_to_video_output(response.content.video_url))
|
||||||
|
|
||||||
|
|||||||
@ -221,14 +221,17 @@ class TencentTextToModelNode(IO.ComfyNode):
|
|||||||
response_model=To3DProTaskResultResponse,
|
response_model=To3DProTaskResultResponse,
|
||||||
status_extractor=lambda r: r.Status,
|
status_extractor=lambda r: r.Status,
|
||||||
)
|
)
|
||||||
obj_result = await download_and_extract_obj_zip(get_file_from_response(result.ResultFile3Ds, "obj").Url)
|
obj_file_response = get_file_from_response(result.ResultFile3Ds, "obj", raise_if_not_found=False)
|
||||||
|
obj_result = None
|
||||||
|
if obj_file_response:
|
||||||
|
obj_result = await download_and_extract_obj_zip(obj_file_response.Url)
|
||||||
return IO.NodeOutput(
|
return IO.NodeOutput(
|
||||||
f"{task_id}.glb",
|
f"{task_id}.glb",
|
||||||
await download_url_to_file_3d(
|
await download_url_to_file_3d(
|
||||||
get_file_from_response(result.ResultFile3Ds, "glb").Url, "glb", task_id=task_id
|
get_file_from_response(result.ResultFile3Ds, "glb").Url, "glb", task_id=task_id
|
||||||
),
|
),
|
||||||
obj_result.obj,
|
obj_result.obj if obj_result else None,
|
||||||
obj_result.texture,
|
obj_result.texture if obj_result else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -378,17 +381,30 @@ class TencentImageToModelNode(IO.ComfyNode):
|
|||||||
response_model=To3DProTaskResultResponse,
|
response_model=To3DProTaskResultResponse,
|
||||||
status_extractor=lambda r: r.Status,
|
status_extractor=lambda r: r.Status,
|
||||||
)
|
)
|
||||||
obj_result = await download_and_extract_obj_zip(get_file_from_response(result.ResultFile3Ds, "obj").Url)
|
obj_file_response = get_file_from_response(result.ResultFile3Ds, "obj", raise_if_not_found=False)
|
||||||
|
if obj_file_response:
|
||||||
|
obj_result = await download_and_extract_obj_zip(obj_file_response.Url)
|
||||||
|
return IO.NodeOutput(
|
||||||
|
f"{task_id}.glb",
|
||||||
|
await download_url_to_file_3d(
|
||||||
|
get_file_from_response(result.ResultFile3Ds, "glb").Url, "glb", task_id=task_id
|
||||||
|
),
|
||||||
|
obj_result.obj,
|
||||||
|
obj_result.texture,
|
||||||
|
obj_result.metallic if obj_result.metallic is not None else torch.zeros(1, 1, 1, 3),
|
||||||
|
obj_result.normal if obj_result.normal is not None else torch.zeros(1, 1, 1, 3),
|
||||||
|
obj_result.roughness if obj_result.roughness is not None else torch.zeros(1, 1, 1, 3),
|
||||||
|
)
|
||||||
return IO.NodeOutput(
|
return IO.NodeOutput(
|
||||||
f"{task_id}.glb",
|
f"{task_id}.glb",
|
||||||
await download_url_to_file_3d(
|
await download_url_to_file_3d(
|
||||||
get_file_from_response(result.ResultFile3Ds, "glb").Url, "glb", task_id=task_id
|
get_file_from_response(result.ResultFile3Ds, "glb").Url, "glb", task_id=task_id
|
||||||
),
|
),
|
||||||
obj_result.obj,
|
None,
|
||||||
obj_result.texture,
|
None,
|
||||||
obj_result.metallic if obj_result.metallic is not None else torch.zeros(1, 1, 1, 3),
|
None,
|
||||||
obj_result.normal if obj_result.normal is not None else torch.zeros(1, 1, 1, 3),
|
None,
|
||||||
obj_result.roughness if obj_result.roughness is not None else torch.zeros(1, 1, 1, 3),
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,44 @@ from comfy_api_nodes.util import (
|
|||||||
)
|
)
|
||||||
from comfy_extras.nodes_images import SVG
|
from comfy_extras.nodes_images import SVG
|
||||||
|
|
||||||
|
_ARROW_MODELS = ["arrow-1.1", "arrow-1.1-max", "arrow-preview"]
|
||||||
|
|
||||||
|
|
||||||
|
def _arrow_sampling_inputs():
|
||||||
|
"""Shared sampling inputs for all Arrow model variants."""
|
||||||
|
return [
|
||||||
|
IO.Float.Input(
|
||||||
|
"temperature",
|
||||||
|
default=1.0,
|
||||||
|
min=0.0,
|
||||||
|
max=2.0,
|
||||||
|
step=0.1,
|
||||||
|
display_mode=IO.NumberDisplay.slider,
|
||||||
|
tooltip="Randomness control. Higher values increase randomness.",
|
||||||
|
advanced=True,
|
||||||
|
),
|
||||||
|
IO.Float.Input(
|
||||||
|
"top_p",
|
||||||
|
default=1.0,
|
||||||
|
min=0.05,
|
||||||
|
max=1.0,
|
||||||
|
step=0.05,
|
||||||
|
display_mode=IO.NumberDisplay.slider,
|
||||||
|
tooltip="Nucleus sampling parameter.",
|
||||||
|
advanced=True,
|
||||||
|
),
|
||||||
|
IO.Float.Input(
|
||||||
|
"presence_penalty",
|
||||||
|
default=0.0,
|
||||||
|
min=-2.0,
|
||||||
|
max=2.0,
|
||||||
|
step=0.1,
|
||||||
|
display_mode=IO.NumberDisplay.slider,
|
||||||
|
tooltip="Token presence penalty.",
|
||||||
|
advanced=True,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class QuiverTextToSVGNode(IO.ComfyNode):
|
class QuiverTextToSVGNode(IO.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -39,6 +77,7 @@ class QuiverTextToSVGNode(IO.ComfyNode):
|
|||||||
default="",
|
default="",
|
||||||
tooltip="Additional style or formatting guidance.",
|
tooltip="Additional style or formatting guidance.",
|
||||||
optional=True,
|
optional=True,
|
||||||
|
advanced=True,
|
||||||
),
|
),
|
||||||
IO.Autogrow.Input(
|
IO.Autogrow.Input(
|
||||||
"reference_images",
|
"reference_images",
|
||||||
@ -53,43 +92,7 @@ class QuiverTextToSVGNode(IO.ComfyNode):
|
|||||||
),
|
),
|
||||||
IO.DynamicCombo.Input(
|
IO.DynamicCombo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=[
|
options=[IO.DynamicCombo.Option(m, _arrow_sampling_inputs()) for m in _ARROW_MODELS],
|
||||||
IO.DynamicCombo.Option(
|
|
||||||
"arrow-preview",
|
|
||||||
[
|
|
||||||
IO.Float.Input(
|
|
||||||
"temperature",
|
|
||||||
default=1.0,
|
|
||||||
min=0.0,
|
|
||||||
max=2.0,
|
|
||||||
step=0.1,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Randomness control. Higher values increase randomness.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
IO.Float.Input(
|
|
||||||
"top_p",
|
|
||||||
default=1.0,
|
|
||||||
min=0.05,
|
|
||||||
max=1.0,
|
|
||||||
step=0.05,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Nucleus sampling parameter.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
IO.Float.Input(
|
|
||||||
"presence_penalty",
|
|
||||||
default=0.0,
|
|
||||||
min=-2.0,
|
|
||||||
max=2.0,
|
|
||||||
step=0.1,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Token presence penalty.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
tooltip="Model to use for SVG generation.",
|
tooltip="Model to use for SVG generation.",
|
||||||
),
|
),
|
||||||
IO.Int.Input(
|
IO.Int.Input(
|
||||||
@ -112,7 +115,16 @@ class QuiverTextToSVGNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
expr="""{"type":"usd","usd":0.429}""",
|
depends_on=IO.PriceBadgeDepends(widgets=["model"]),
|
||||||
|
expr="""
|
||||||
|
(
|
||||||
|
$contains(widgets.model, "max")
|
||||||
|
? {"type":"usd","usd":0.3575}
|
||||||
|
: $contains(widgets.model, "preview")
|
||||||
|
? {"type":"usd","usd":0.429}
|
||||||
|
: {"type":"usd","usd":0.286}
|
||||||
|
)
|
||||||
|
""",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -176,12 +188,13 @@ class QuiverImageToSVGNode(IO.ComfyNode):
|
|||||||
"auto_crop",
|
"auto_crop",
|
||||||
default=False,
|
default=False,
|
||||||
tooltip="Automatically crop to the dominant subject.",
|
tooltip="Automatically crop to the dominant subject.",
|
||||||
|
advanced=True,
|
||||||
),
|
),
|
||||||
IO.DynamicCombo.Input(
|
IO.DynamicCombo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=[
|
options=[
|
||||||
IO.DynamicCombo.Option(
|
IO.DynamicCombo.Option(
|
||||||
"arrow-preview",
|
m,
|
||||||
[
|
[
|
||||||
IO.Int.Input(
|
IO.Int.Input(
|
||||||
"target_size",
|
"target_size",
|
||||||
@ -189,39 +202,12 @@ class QuiverImageToSVGNode(IO.ComfyNode):
|
|||||||
min=128,
|
min=128,
|
||||||
max=4096,
|
max=4096,
|
||||||
tooltip="Square resize target in pixels.",
|
tooltip="Square resize target in pixels.",
|
||||||
),
|
|
||||||
IO.Float.Input(
|
|
||||||
"temperature",
|
|
||||||
default=1.0,
|
|
||||||
min=0.0,
|
|
||||||
max=2.0,
|
|
||||||
step=0.1,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Randomness control. Higher values increase randomness.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
IO.Float.Input(
|
|
||||||
"top_p",
|
|
||||||
default=1.0,
|
|
||||||
min=0.05,
|
|
||||||
max=1.0,
|
|
||||||
step=0.05,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Nucleus sampling parameter.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
IO.Float.Input(
|
|
||||||
"presence_penalty",
|
|
||||||
default=0.0,
|
|
||||||
min=-2.0,
|
|
||||||
max=2.0,
|
|
||||||
step=0.1,
|
|
||||||
display_mode=IO.NumberDisplay.slider,
|
|
||||||
tooltip="Token presence penalty.",
|
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
|
*_arrow_sampling_inputs(),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
for m in _ARROW_MODELS
|
||||||
],
|
],
|
||||||
tooltip="Model to use for SVG vectorization.",
|
tooltip="Model to use for SVG vectorization.",
|
||||||
),
|
),
|
||||||
@ -245,7 +231,16 @@ class QuiverImageToSVGNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
expr="""{"type":"usd","usd":0.429}""",
|
depends_on=IO.PriceBadgeDepends(widgets=["model"]),
|
||||||
|
expr="""
|
||||||
|
(
|
||||||
|
$contains(widgets.model, "max")
|
||||||
|
? {"type":"usd","usd":0.3575}
|
||||||
|
: $contains(widgets.model, "preview")
|
||||||
|
? {"type":"usd","usd":0.429}
|
||||||
|
: {"type":"usd","usd":0.286}
|
||||||
|
)
|
||||||
|
""",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -401,7 +401,7 @@ class StabilityUpscaleConservativeNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
expr="""{"type":"usd","usd":0.25}""",
|
expr="""{"type":"usd","usd":0.4}""",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ class StabilityUpscaleCreativeNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
expr="""{"type":"usd","usd":0.25}""",
|
expr="""{"type":"usd","usd":0.6}""",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -593,7 +593,7 @@ class StabilityUpscaleFastNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
expr="""{"type":"usd","usd":0.01}""",
|
expr="""{"type":"usd","usd":0.02}""",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
|
import json
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from comfy_api.latest import ComfyExtension, io
|
from comfy_api.latest import ComfyExtension, io
|
||||||
@ -375,6 +376,39 @@ class RegexReplace(io.ComfyNode):
|
|||||||
return io.NodeOutput(result)
|
return io.NodeOutput(result)
|
||||||
|
|
||||||
|
|
||||||
|
class JsonExtractString(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="JsonExtractString",
|
||||||
|
display_name="Extract String from JSON",
|
||||||
|
category="utils/string",
|
||||||
|
search_aliases=["json", "extract json", "parse json", "json value", "read json"],
|
||||||
|
inputs=[
|
||||||
|
io.String.Input("json_string", multiline=True),
|
||||||
|
io.String.Input("key", multiline=False),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.String.Output(),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, json_string, key):
|
||||||
|
try:
|
||||||
|
data = json.loads(json_string)
|
||||||
|
if isinstance(data, dict) and key in data:
|
||||||
|
value = data[key]
|
||||||
|
if value is None:
|
||||||
|
return io.NodeOutput("")
|
||||||
|
|
||||||
|
return io.NodeOutput(str(value))
|
||||||
|
|
||||||
|
return io.NodeOutput("")
|
||||||
|
|
||||||
|
except (json.JSONDecodeError, TypeError):
|
||||||
|
return io.NodeOutput("")
|
||||||
|
|
||||||
class StringExtension(ComfyExtension):
|
class StringExtension(ComfyExtension):
|
||||||
@override
|
@override
|
||||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
@ -390,6 +424,7 @@ class StringExtension(ComfyExtension):
|
|||||||
RegexMatch,
|
RegexMatch,
|
||||||
RegexExtract,
|
RegexExtract,
|
||||||
RegexReplace,
|
RegexReplace,
|
||||||
|
JsonExtractString,
|
||||||
]
|
]
|
||||||
|
|
||||||
async def comfy_entrypoint() -> StringExtension:
|
async def comfy_entrypoint() -> StringExtension:
|
||||||
|
|||||||
@ -161,12 +161,12 @@ class TextGenerateLTX2Prompt(TextGenerate):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, clip, prompt, max_length, sampling_mode, image=None, thinking=False) -> io.NodeOutput:
|
def execute(cls, clip, prompt, max_length, sampling_mode, image=None, thinking=False, use_default_template=True) -> io.NodeOutput:
|
||||||
if image is None:
|
if image is None:
|
||||||
formatted_prompt = f"<start_of_turn>system\n{LTX2_T2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
|
formatted_prompt = f"<start_of_turn>system\n{LTX2_T2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
|
||||||
else:
|
else:
|
||||||
formatted_prompt = f"<start_of_turn>system\n{LTX2_I2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\n\n<image_soft_token>\n\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
|
formatted_prompt = f"<start_of_turn>system\n{LTX2_I2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\n\n<image_soft_token>\n\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
|
||||||
return super().execute(clip, formatted_prompt, max_length, sampling_mode, image, thinking)
|
return super().execute(clip, formatted_prompt, max_length, sampling_mode, image, thinking, use_default_template)
|
||||||
|
|
||||||
|
|
||||||
class TextgenExtension(ComfyExtension):
|
class TextgenExtension(ComfyExtension):
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# This file is automatically generated by the build process when version is
|
# This file is automatically generated by the build process when version is
|
||||||
# updated in pyproject.toml.
|
# updated in pyproject.toml.
|
||||||
__version__ = "0.19.1"
|
__version__ = "0.19.3"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "ComfyUI"
|
name = "ComfyUI"
|
||||||
version = "0.19.1"
|
version = "0.19.3"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { file = "LICENSE" }
|
license = { file = "LICENSE" }
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.42.11
|
comfyui-frontend-package==1.42.11
|
||||||
comfyui-workflow-templates==0.9.54
|
comfyui-workflow-templates==0.9.57
|
||||||
comfyui-embedded-docs==0.4.3
|
comfyui-embedded-docs==0.4.3
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user