ComfyUI/comfy/api/server.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

35 lines
1.0 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
import abc
import dataclasses
import typing
from comfy.api.schemas import validation, schema
@dataclasses.dataclass
class ServerWithoutVariables(abc.ABC):
url: str
@dataclasses.dataclass
class ServerWithVariables(abc.ABC):
_url: str
variables: validation.immutabledict[str, str]
variables_schema: typing.Type[schema.Schema]
url: str = dataclasses.field(init=False)
def __post_init__(self):
url = self._url
assert isinstance (self.variables, self.variables_schema().type_to_output_cls[validation.immutabledict])
for (key, value) in self.variables.items():
url = url.replace("{" + key + "}", value)
self.url = url