ComfyUI/comfy/api/components/schema/prompt.py
doctorpangloss 1b2ea61345 Improved API support
- 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.
2024-02-07 14:20:21 -08:00

101 lines
3.1 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]
from comfy.api.components.schema import prompt_node
class PromptDict(schemas.immutabledict[str, prompt_node.PromptNodeDict]):
__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[
prompt_node.PromptNodeDictInput,
prompt_node.PromptNodeDict,
],
):
used_kwargs = typing.cast(PromptDictInput, kwargs)
return Prompt.validate(used_kwargs, configuration=configuration_)
@staticmethod
def from_dict_(
arg: typing.Union[
PromptDictInput,
PromptDict
],
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> PromptDict:
return Prompt.validate(arg, configuration=configuration)
def get_additional_property_(self, name: str) -> typing.Union[prompt_node.PromptNodeDict, 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(
prompt_node.PromptNodeDict,
val
)
PromptDictInput = typing.Mapping[
str,
typing.Union[
prompt_node.PromptNodeDictInput,
prompt_node.PromptNodeDict,
],
]
@dataclasses.dataclass(frozen=True)
class Prompt(
schemas.Schema[PromptDict, 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.
The keys are stringified integers corresponding to nodes.
You can retrieve the last prompt run using GET /api/v1/prompts
"""
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
additional_properties: typing.Type[prompt_node.PromptNode] = dataclasses.field(default_factory=lambda: prompt_node.PromptNode) # type: ignore
type_to_output_cls: typing.Mapping[
typing.Type,
typing.Type
] = dataclasses.field(
default_factory=lambda: {
schemas.immutabledict: PromptDict
}
)
@classmethod
def validate(
cls,
arg: typing.Union[
PromptDictInput,
PromptDict,
],
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> PromptDict:
return super().validate_base(
arg,
configuration=configuration,
)