mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
- Run comfyui workflows directly inside other python applications using EmbeddedComfyClient. - Optional telemetry in prompts and models using anonymity preserving Plausible self-hosted or hosted. - Better OpenAPI schema - Basic support for distributed ComfyUI backends. Limitations: no progress reporting, no easy way to start your own distributed backend, requires RabbitMQ as a message broker.
406 lines
11 KiB
Python
406 lines
11 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
comfyui
|
|
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
|
The version of the OpenAPI document: 0.0.1
|
|
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
|
|
|
ClassType: typing_extensions.TypeAlias = schemas.StrSchema
|
|
_0: typing_extensions.TypeAlias = schemas.NumberSchema
|
|
_1: typing_extensions.TypeAlias = schemas.StrSchema
|
|
_2: typing_extensions.TypeAlias = schemas.BoolSchema
|
|
|
|
|
|
class ItemsTuple(
|
|
typing.Tuple[
|
|
str,
|
|
int,
|
|
typing_extensions.Unpack[typing.Tuple[schemas.OUTPUT_BASE_TYPES, ...]]
|
|
]
|
|
):
|
|
|
|
def __new__(cls, arg: typing.Union[ItemsTupleInput, ItemsTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
|
return Items.validate(arg, configuration=configuration)
|
|
ItemsTupleInput = typing.Union[
|
|
typing.List[
|
|
typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES
|
|
],
|
|
],
|
|
typing.Tuple[
|
|
str,
|
|
int,
|
|
typing_extensions.Unpack[typing.Tuple[schemas.INPUT_TYPES_ALL, ...]]
|
|
]
|
|
]
|
|
_02: typing_extensions.TypeAlias = schemas.StrSchema
|
|
_12: typing_extensions.TypeAlias = schemas.IntSchema
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Items(
|
|
schemas.AnyTypeSchema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], ItemsTuple],
|
|
):
|
|
# any type
|
|
prefix_items: typing.Tuple[
|
|
typing.Type[_02],
|
|
typing.Type[_12],
|
|
] = (
|
|
_02,
|
|
_12,
|
|
)
|
|
max_items: int = 2
|
|
min_items: int = 2
|
|
type_to_output_cls: typing.Mapping[
|
|
typing.Type,
|
|
typing.Type
|
|
] = dataclasses.field(
|
|
default_factory=lambda: {
|
|
tuple: ItemsTuple,
|
|
}
|
|
)
|
|
|
|
|
|
|
|
class _3Tuple(
|
|
typing.Tuple[
|
|
schemas.OUTPUT_BASE_TYPES,
|
|
...
|
|
]
|
|
):
|
|
|
|
def __new__(cls, arg: typing.Union[_3TupleInput, _3Tuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
|
return _3.validate(arg, configuration=configuration)
|
|
_3TupleInput = typing.Union[
|
|
typing.List[
|
|
typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES
|
|
],
|
|
],
|
|
typing.Tuple[
|
|
typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES
|
|
],
|
|
...
|
|
]
|
|
]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class _3(
|
|
schemas.Schema[schemas.immutabledict, _3Tuple]
|
|
):
|
|
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
|
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
|
type_to_output_cls: typing.Mapping[
|
|
typing.Type,
|
|
typing.Type
|
|
] = dataclasses.field(
|
|
default_factory=lambda: {
|
|
tuple: _3Tuple
|
|
}
|
|
)
|
|
|
|
@classmethod
|
|
def validate(
|
|
cls,
|
|
arg: typing.Union[
|
|
_3TupleInput,
|
|
_3Tuple,
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> _3Tuple:
|
|
return super().validate_base(
|
|
arg,
|
|
configuration=configuration,
|
|
)
|
|
OneOf = typing.Tuple[
|
|
typing.Type[_0],
|
|
typing.Type[_1],
|
|
typing.Type[_2],
|
|
typing.Type[_3],
|
|
]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class AdditionalProperties(
|
|
schemas.AnyTypeSchema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], typing.Tuple[schemas.OUTPUT_BASE_TYPES, ...]],
|
|
):
|
|
# any type
|
|
one_of: OneOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(OneOf)) # type: ignore
|
|
|
|
|
|
|
|
class InputsDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
|
|
|
__required_keys__: typing.FrozenSet[str] = frozenset({
|
|
})
|
|
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
|
})
|
|
def __new__(
|
|
cls,
|
|
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
|
**kwargs: typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES
|
|
],
|
|
):
|
|
used_kwargs = typing.cast(InputsDictInput, kwargs)
|
|
return Inputs.validate(used_kwargs, configuration=configuration_)
|
|
|
|
@staticmethod
|
|
def from_dict_(
|
|
arg: typing.Union[
|
|
InputsDictInput,
|
|
InputsDict
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> InputsDict:
|
|
return Inputs.validate(arg, configuration=configuration)
|
|
|
|
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
|
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
|
val = self.get(name, schemas.unset)
|
|
if isinstance(val, schemas.Unset):
|
|
return val
|
|
return typing.cast(
|
|
schemas.OUTPUT_BASE_TYPES,
|
|
val
|
|
)
|
|
InputsDictInput = typing.Mapping[
|
|
str,
|
|
typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES
|
|
],
|
|
]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Inputs(
|
|
schemas.Schema[InputsDict, tuple]
|
|
):
|
|
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
|
additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore
|
|
type_to_output_cls: typing.Mapping[
|
|
typing.Type,
|
|
typing.Type
|
|
] = dataclasses.field(
|
|
default_factory=lambda: {
|
|
schemas.immutabledict: InputsDict
|
|
}
|
|
)
|
|
|
|
@classmethod
|
|
def validate(
|
|
cls,
|
|
arg: typing.Union[
|
|
InputsDictInput,
|
|
InputsDict,
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> InputsDict:
|
|
return super().validate_base(
|
|
arg,
|
|
configuration=configuration,
|
|
)
|
|
|
|
Items2: typing_extensions.TypeAlias = schemas.StrSchema
|
|
|
|
|
|
class _0Tuple(
|
|
typing.Tuple[
|
|
str,
|
|
...
|
|
]
|
|
):
|
|
|
|
def __new__(cls, arg: typing.Union[_0TupleInput, _0Tuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
|
return _03.validate(arg, configuration=configuration)
|
|
_0TupleInput = typing.Union[
|
|
typing.List[
|
|
str,
|
|
],
|
|
typing.Tuple[
|
|
str,
|
|
...
|
|
]
|
|
]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class _03(
|
|
schemas.Schema[schemas.immutabledict, _0Tuple]
|
|
):
|
|
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
|
items: typing.Type[Items2] = dataclasses.field(default_factory=lambda: Items2) # type: ignore
|
|
type_to_output_cls: typing.Mapping[
|
|
typing.Type,
|
|
typing.Type
|
|
] = dataclasses.field(
|
|
default_factory=lambda: {
|
|
tuple: _0Tuple
|
|
}
|
|
)
|
|
|
|
@classmethod
|
|
def validate(
|
|
cls,
|
|
arg: typing.Union[
|
|
_0TupleInput,
|
|
_0Tuple,
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> _0Tuple:
|
|
return super().validate_base(
|
|
arg,
|
|
configuration=configuration,
|
|
)
|
|
_13: typing_extensions.TypeAlias = schemas.StrSchema
|
|
OneOf2 = typing.Tuple[
|
|
typing.Type[_03],
|
|
typing.Type[_13],
|
|
]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class IsChanged(
|
|
schemas.AnyTypeSchema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], typing.Tuple[schemas.OUTPUT_BASE_TYPES, ...]],
|
|
):
|
|
# any type
|
|
one_of: OneOf2 = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(OneOf2)) # type: ignore
|
|
|
|
Properties = typing.TypedDict(
|
|
'Properties',
|
|
{
|
|
"class_type": typing.Type[ClassType],
|
|
"inputs": typing.Type[Inputs],
|
|
"is_changed": typing.Type[IsChanged],
|
|
}
|
|
)
|
|
|
|
|
|
class PromptNodeDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
|
|
|
__required_keys__: typing.FrozenSet[str] = frozenset({
|
|
"class_type",
|
|
"inputs",
|
|
})
|
|
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
|
"is_changed",
|
|
})
|
|
|
|
def __new__(
|
|
cls,
|
|
*,
|
|
class_type: str,
|
|
inputs: typing.Union[
|
|
InputsDictInput,
|
|
InputsDict,
|
|
],
|
|
is_changed: typing.Union[
|
|
schemas.INPUT_TYPES_ALL,
|
|
schemas.OUTPUT_BASE_TYPES,
|
|
schemas.Unset
|
|
] = schemas.unset,
|
|
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
|
**kwargs: schemas.INPUT_TYPES_ALL,
|
|
):
|
|
arg_: typing.Dict[str, typing.Any] = {
|
|
"class_type": class_type,
|
|
"inputs": inputs,
|
|
}
|
|
for key_, val in (
|
|
("is_changed", is_changed),
|
|
):
|
|
if isinstance(val, schemas.Unset):
|
|
continue
|
|
arg_[key_] = val
|
|
arg_.update(kwargs)
|
|
used_arg_ = typing.cast(PromptNodeDictInput, arg_)
|
|
return PromptNode.validate(used_arg_, configuration=configuration_)
|
|
|
|
@staticmethod
|
|
def from_dict_(
|
|
arg: typing.Union[
|
|
PromptNodeDictInput,
|
|
PromptNodeDict
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> PromptNodeDict:
|
|
return PromptNode.validate(arg, configuration=configuration)
|
|
|
|
@property
|
|
def class_type(self) -> str:
|
|
return typing.cast(
|
|
str,
|
|
self.__getitem__("class_type")
|
|
)
|
|
|
|
@property
|
|
def inputs(self) -> InputsDict:
|
|
return typing.cast(
|
|
InputsDict,
|
|
self.__getitem__("inputs")
|
|
)
|
|
|
|
@property
|
|
def is_changed(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
|
val = self.get("is_changed", schemas.unset)
|
|
if isinstance(val, schemas.Unset):
|
|
return val
|
|
return val
|
|
|
|
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
|
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
|
return self.get(name, schemas.unset)
|
|
PromptNodeDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class PromptNode(
|
|
schemas.Schema[PromptNodeDict, tuple]
|
|
):
|
|
"""NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
|
|
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
|
|
|
Do not edit the class manually.
|
|
"""
|
|
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
|
required: typing.FrozenSet[str] = frozenset({
|
|
"class_type",
|
|
"inputs",
|
|
})
|
|
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
|
type_to_output_cls: typing.Mapping[
|
|
typing.Type,
|
|
typing.Type
|
|
] = dataclasses.field(
|
|
default_factory=lambda: {
|
|
schemas.immutabledict: PromptNodeDict
|
|
}
|
|
)
|
|
|
|
@classmethod
|
|
def validate(
|
|
cls,
|
|
arg: typing.Union[
|
|
PromptNodeDictInput,
|
|
PromptNodeDict,
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> PromptNodeDict:
|
|
return super().validate_base(
|
|
arg,
|
|
configuration=configuration,
|
|
)
|
|
|