mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +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.
150 lines
4.6 KiB
Python
150 lines
4.6 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]
|
|
|
|
ClientId: typing_extensions.TypeAlias = schemas.StrSchema
|
|
|
|
from comfy.api.components.schema import extra_data
|
|
from comfy.api.components.schema import prompt
|
|
Properties = typing.TypedDict(
|
|
'Properties',
|
|
{
|
|
"client_id": typing.Type[ClientId],
|
|
"prompt": typing.Type[prompt.Prompt],
|
|
"extra_data": typing.Type[extra_data.ExtraData],
|
|
}
|
|
)
|
|
|
|
|
|
class PromptRequestDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
|
|
|
__required_keys__: typing.FrozenSet[str] = frozenset({
|
|
"prompt",
|
|
})
|
|
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
|
"client_id",
|
|
"extra_data",
|
|
})
|
|
|
|
def __new__(
|
|
cls,
|
|
*,
|
|
prompt: typing.Union[
|
|
prompt.PromptDictInput,
|
|
prompt.PromptDict,
|
|
],
|
|
client_id: typing.Union[
|
|
str,
|
|
schemas.Unset
|
|
] = schemas.unset,
|
|
extra_data: typing.Union[
|
|
extra_data.ExtraDataDictInput,
|
|
extra_data.ExtraDataDict,
|
|
schemas.Unset
|
|
] = schemas.unset,
|
|
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
|
**kwargs: schemas.INPUT_TYPES_ALL,
|
|
):
|
|
arg_: typing.Dict[str, typing.Any] = {
|
|
"prompt": prompt,
|
|
}
|
|
for key_, val in (
|
|
("client_id", client_id),
|
|
("extra_data", extra_data),
|
|
):
|
|
if isinstance(val, schemas.Unset):
|
|
continue
|
|
arg_[key_] = val
|
|
arg_.update(kwargs)
|
|
used_arg_ = typing.cast(PromptRequestDictInput, arg_)
|
|
return PromptRequest.validate(used_arg_, configuration=configuration_)
|
|
|
|
@staticmethod
|
|
def from_dict_(
|
|
arg: typing.Union[
|
|
PromptRequestDictInput,
|
|
PromptRequestDict
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> PromptRequestDict:
|
|
return PromptRequest.validate(arg, configuration=configuration)
|
|
|
|
@property
|
|
def prompt(self) -> prompt.PromptDict:
|
|
return typing.cast(
|
|
prompt.PromptDict,
|
|
self.__getitem__("prompt")
|
|
)
|
|
|
|
@property
|
|
def client_id(self) -> typing.Union[str, schemas.Unset]:
|
|
val = self.get("client_id", schemas.unset)
|
|
if isinstance(val, schemas.Unset):
|
|
return val
|
|
return typing.cast(
|
|
str,
|
|
val
|
|
)
|
|
|
|
@property
|
|
def extra_data(self) -> typing.Union[extra_data.ExtraDataDict, schemas.Unset]:
|
|
val = self.get("extra_data", schemas.unset)
|
|
if isinstance(val, schemas.Unset):
|
|
return val
|
|
return typing.cast(
|
|
extra_data.ExtraDataDict,
|
|
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)
|
|
PromptRequestDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class PromptRequest(
|
|
schemas.Schema[PromptRequestDict, 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({
|
|
"prompt",
|
|
})
|
|
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: PromptRequestDict
|
|
}
|
|
)
|
|
|
|
@classmethod
|
|
def validate(
|
|
cls,
|
|
arg: typing.Union[
|
|
PromptRequestDictInput,
|
|
PromptRequestDict,
|
|
],
|
|
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
|
) -> PromptRequestDict:
|
|
return super().validate_base(
|
|
arg,
|
|
configuration=configuration,
|
|
)
|
|
|