mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2025-12-09 05:54:24 +08:00
convert nodes_edit_model.py to V3 schema (#10147)
This commit is contained in:
parent
5c8e986e27
commit
4614ee09ca
@ -1,26 +1,38 @@
|
|||||||
import node_helpers
|
import node_helpers
|
||||||
|
from typing_extensions import override
|
||||||
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
|
|
||||||
class ReferenceLatent:
|
class ReferenceLatent(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def define_schema(cls):
|
||||||
return {"required": {"conditioning": ("CONDITIONING", ),
|
return io.Schema(
|
||||||
},
|
node_id="ReferenceLatent",
|
||||||
"optional": {"latent": ("LATENT", ),}
|
category="advanced/conditioning/edit_models",
|
||||||
}
|
description="This node sets the guiding latent for an edit model. If the model supports it you can chain multiple to set multiple reference images.",
|
||||||
|
inputs=[
|
||||||
|
io.Conditioning.Input("conditioning"),
|
||||||
|
io.Latent.Input("latent", optional=True),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Conditioning.Output(),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
@classmethod
|
||||||
FUNCTION = "append"
|
def execute(cls, conditioning, latent=None) -> io.NodeOutput:
|
||||||
|
|
||||||
CATEGORY = "advanced/conditioning/edit_models"
|
|
||||||
DESCRIPTION = "This node sets the guiding latent for an edit model. If the model supports it you can chain multiple to set multiple reference images."
|
|
||||||
|
|
||||||
def append(self, conditioning, latent=None):
|
|
||||||
if latent is not None:
|
if latent is not None:
|
||||||
conditioning = node_helpers.conditioning_set_values(conditioning, {"reference_latents": [latent["samples"]]}, append=True)
|
conditioning = node_helpers.conditioning_set_values(conditioning, {"reference_latents": [latent["samples"]]}, append=True)
|
||||||
return (conditioning, )
|
return io.NodeOutput(conditioning)
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
class EditModelExtension(ComfyExtension):
|
||||||
"ReferenceLatent": ReferenceLatent,
|
@override
|
||||||
}
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
|
return [
|
||||||
|
ReferenceLatent,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def comfy_entrypoint() -> EditModelExtension:
|
||||||
|
return EditModelExtension()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user