feat(nodes): remove meta node field; use individual is_intermediate field instead

as suggested by @Kyle0654
This commit is contained in:
psychedelicious 2023-05-26 11:39:19 +10:00 committed by Kent Keirsey
parent 43d991cfdb
commit 33e13820fc
8 changed files with 20 additions and 27 deletions

View File

@ -39,12 +39,6 @@ class BaseInvocationOutput(BaseModel):
return tuple(subclasses)
class InvocationMeta(BaseModel):
is_intermediate: bool = Field(
default=False,
description="Whether this is an intermediate node. Intermediate nodes are periodically deleted."
)
class BaseInvocation(ABC, BaseModel):
"""A node to process inputs and produce outputs.
May use dependency injection in __init__ to receive providers.
@ -84,8 +78,7 @@ class BaseInvocation(ABC, BaseModel):
#fmt: off
id: str = Field(description="The id of this node. Must be unique among all nodes.")
type: str = Field(description="The type of this node. Must be unique among all nodes.")
meta: InvocationMeta = Field(default=InvocationMeta(), description="The meta properties of this node.")
is_intermediate: bool = Field(default=False, description="Whether or not this node is an intermediate node.")
#fmt: on

View File

@ -61,7 +61,7 @@ class CvInpaintInvocation(BaseInvocation, CvInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(

View File

@ -101,7 +101,7 @@ class TextToImageInvocation(BaseInvocation, SDImageInvocation):
image_category=ImageCategory.GENERAL,
session_id=context.graph_execution_state_id,
node_id=self.id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -182,7 +182,7 @@ class ImageToImageInvocation(TextToImageInvocation):
image_category=ImageCategory.GENERAL,
session_id=context.graph_execution_state_id,
node_id=self.id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -298,7 +298,7 @@ class InpaintInvocation(ImageToImageInvocation):
image_category=ImageCategory.GENERAL,
session_id=context.graph_execution_state_id,
node_id=self.id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(

View File

@ -143,7 +143,7 @@ class ImageCropInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -205,7 +205,7 @@ class ImagePasteInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -244,7 +244,7 @@ class MaskFromAlphaInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.MASK,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return MaskOutput(
@ -283,7 +283,7 @@ class ImageMultiplyInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -322,7 +322,7 @@ class ImageChannelInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -361,7 +361,7 @@ class ImageConvertInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -403,7 +403,7 @@ class ImageBlurInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -444,7 +444,7 @@ class ImageLerpInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -490,7 +490,7 @@ class ImageInverseLerpInvocation(BaseInvocation, PILInvocationConfig):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(

View File

@ -149,7 +149,7 @@ class InfillColorInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -194,7 +194,7 @@ class InfillTileInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(
@ -232,7 +232,7 @@ class InfillPatchMatchInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(

View File

@ -370,7 +370,7 @@ class LatentsToImageInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
session_id=context.graph_execution_state_id,
node_id=self.id,
is_intermediate=self.meta.is_intermediate
is_intermediate=self.is_intermediate
)
return ImageOutput(

View File

@ -47,7 +47,7 @@ class RestoreFaceInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(

View File

@ -49,7 +49,7 @@ class UpscaleInvocation(BaseInvocation):
image_category=ImageCategory.GENERAL,
node_id=self.id,
session_id=context.graph_execution_state_id,
is_intermediate=self.meta.is_intermediate,
is_intermediate=self.is_intermediate,
)
return ImageOutput(