mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-21 23:41:28 +08:00
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.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints then import them from
|
||||
# tags, paths, or path_to_api, or tag_to_api
|
||||
@@ -0,0 +1,50 @@
|
||||
import typing
|
||||
import typing_extensions
|
||||
|
||||
from comfy.api.apis.paths.solidus import Solidus
|
||||
from comfy.api.apis.paths.api_v1_images_digest import ApiV1ImagesDigest
|
||||
from comfy.api.apis.paths.api_v1_prompts import ApiV1Prompts
|
||||
from comfy.api.apis.paths.embeddings import Embeddings
|
||||
from comfy.api.apis.paths.extensions import Extensions
|
||||
from comfy.api.apis.paths.history import History
|
||||
from comfy.api.apis.paths.interrupt import Interrupt
|
||||
from comfy.api.apis.paths.object_info import ObjectInfo
|
||||
from comfy.api.apis.paths.prompt import Prompt
|
||||
from comfy.api.apis.paths.queue import Queue
|
||||
from comfy.api.apis.paths.upload_image import UploadImage
|
||||
from comfy.api.apis.paths.view import View
|
||||
|
||||
PathToApi = typing.TypedDict(
|
||||
'PathToApi',
|
||||
{
|
||||
"/": typing.Type[Solidus],
|
||||
"/api/v1/images/{digest}": typing.Type[ApiV1ImagesDigest],
|
||||
"/api/v1/prompts": typing.Type[ApiV1Prompts],
|
||||
"/embeddings": typing.Type[Embeddings],
|
||||
"/extensions": typing.Type[Extensions],
|
||||
"/history": typing.Type[History],
|
||||
"/interrupt": typing.Type[Interrupt],
|
||||
"/object_info": typing.Type[ObjectInfo],
|
||||
"/prompt": typing.Type[Prompt],
|
||||
"/queue": typing.Type[Queue],
|
||||
"/upload/image": typing.Type[UploadImage],
|
||||
"/view": typing.Type[View],
|
||||
}
|
||||
)
|
||||
|
||||
path_to_api = PathToApi(
|
||||
{
|
||||
"/": Solidus,
|
||||
"/api/v1/images/{digest}": ApiV1ImagesDigest,
|
||||
"/api/v1/prompts": ApiV1Prompts,
|
||||
"/embeddings": Embeddings,
|
||||
"/extensions": Extensions,
|
||||
"/history": History,
|
||||
"/interrupt": Interrupt,
|
||||
"/object_info": ObjectInfo,
|
||||
"/prompt": Prompt,
|
||||
"/queue": Queue,
|
||||
"/upload/image": UploadImage,
|
||||
"/view": View,
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.path_to_api import path_to_api
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.api_v1_images_digest.get.operation import ApiForGet
|
||||
|
||||
|
||||
class ApiV1ImagesDigest(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,15 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.api_v1_prompts.get.operation import ApiForGet
|
||||
from comfy.api.paths.api_v1_prompts.post.operation import ApiForPost
|
||||
|
||||
|
||||
class ApiV1Prompts(
|
||||
ApiForGet,
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.embeddings.get.operation import ApiForGet
|
||||
|
||||
|
||||
class Embeddings(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.extensions.get.operation import ApiForGet
|
||||
|
||||
|
||||
class Extensions(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,15 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.history.get.operation import ApiForGet
|
||||
from comfy.api.paths.history.post.operation import ApiForPost
|
||||
|
||||
|
||||
class History(
|
||||
ApiForGet,
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.interrupt.post.operation import ApiForPost
|
||||
|
||||
|
||||
class Interrupt(
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.object_info.get.operation import ApiForGet
|
||||
|
||||
|
||||
class ObjectInfo(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,15 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.prompt.get.operation import ApiForGet
|
||||
from comfy.api.paths.prompt.post.operation import ApiForPost
|
||||
|
||||
|
||||
class Prompt(
|
||||
ApiForGet,
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,15 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.queue.get.operation import ApiForGet
|
||||
from comfy.api.paths.queue.post.operation import ApiForPost
|
||||
|
||||
|
||||
class Queue(
|
||||
ApiForGet,
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.solidus.get.operation import ApiForGet
|
||||
|
||||
|
||||
class Solidus(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.upload_image.post.operation import ApiForPost
|
||||
|
||||
|
||||
class UploadImage(
|
||||
ApiForPost,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.view.get.operation import ApiForGet
|
||||
|
||||
|
||||
class View(
|
||||
ApiForGet,
|
||||
):
|
||||
pass
|
||||
@@ -0,0 +1,17 @@
|
||||
import typing
|
||||
import typing_extensions
|
||||
|
||||
from comfy.api.apis.tags.default_api import DefaultApi
|
||||
|
||||
TagToApi = typing.TypedDict(
|
||||
'TagToApi',
|
||||
{
|
||||
"default": typing.Type[DefaultApi],
|
||||
}
|
||||
)
|
||||
|
||||
tag_to_api = TagToApi(
|
||||
{
|
||||
"default": DefaultApi,
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.tag_to_api import tag_to_api
|
||||
@@ -0,0 +1,48 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.paths.api_v1_images_digest.get.operation import ApiV1ImagesDigestGet
|
||||
from comfy.api.paths.api_v1_prompts.get.operation import ApiV1PromptsGet
|
||||
from comfy.api.paths.api_v1_prompts.post.operation import ApiV1PromptsPost
|
||||
from comfy.api.paths.prompt.get.operation import GetPrompt
|
||||
from comfy.api.paths.prompt.post.operation import PostPrompt
|
||||
from comfy.api.paths.extensions.get.operation import GetExtensions
|
||||
from comfy.api.paths.interrupt.post.operation import PostInterrupt
|
||||
from comfy.api.paths.history.get.operation import GetHistory
|
||||
from comfy.api.paths.history.post.operation import PostHistory
|
||||
from comfy.api.paths.queue.get.operation import GetQueue
|
||||
from comfy.api.paths.queue.post.operation import PostQueue
|
||||
from comfy.api.paths.upload_image.post.operation import UploadImage
|
||||
from comfy.api.paths.object_info.get.operation import GetObjectInfo
|
||||
from comfy.api.paths.view.get.operation import ViewImage
|
||||
from comfy.api.paths.embeddings.get.operation import GetEmbeddings
|
||||
from comfy.api.paths.solidus.get.operation import GetRoot
|
||||
|
||||
|
||||
class DefaultApi(
|
||||
ApiV1ImagesDigestGet,
|
||||
ApiV1PromptsGet,
|
||||
ApiV1PromptsPost,
|
||||
GetPrompt,
|
||||
PostPrompt,
|
||||
GetExtensions,
|
||||
PostInterrupt,
|
||||
GetHistory,
|
||||
PostHistory,
|
||||
GetQueue,
|
||||
PostQueue,
|
||||
UploadImage,
|
||||
GetObjectInfo,
|
||||
ViewImage,
|
||||
GetEmbeddings,
|
||||
GetRoot,
|
||||
):
|
||||
"""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.
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user