From dbc8ee92a500ebcf962fc59fec0b2b3a197a32b1 Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Thu, 26 Sep 2024 18:08:15 -0700 Subject: [PATCH] Add method to make this congruent with aio client --- comfy/client/embedded_comfy_client.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/comfy/client/embedded_comfy_client.py b/comfy/client/embedded_comfy_client.py index 68e9767bb..fd3d26bc0 100644 --- a/comfy/client/embedded_comfy_client.py +++ b/comfy/client/embedded_comfy_client.py @@ -14,6 +14,7 @@ from opentelemetry import context, propagate from opentelemetry.context import Context, attach, detach from opentelemetry.trace import Status, StatusCode +from .client_types import V1QueuePromptResponse from ..api.components.schema.prompt import PromptDict from ..cli_args_types import Configuration from ..cmd.main_pre import tracer @@ -132,6 +133,7 @@ class EmbeddedComfyClient: In order to use this in blocking methods, learn more about asyncio online. """ + def __init__(self, configuration: Optional[Configuration] = None, progress_handler: Optional[ExecutorToClientProgress] = None, max_workers: int = 1, executor: Executor = None): self._progress_handler = progress_handler or ServerStub() self._executor = executor or ThreadPoolExecutor(max_workers=max_workers) @@ -162,6 +164,11 @@ class EmbeddedComfyClient: self._executor.shutdown(wait=True) self._is_running = False + async def queue_prompt_api(self, + prompt: PromptDict) -> V1QueuePromptResponse: + outputs = await self.queue_prompt(prompt) + return V1QueuePromptResponse(**outputs) + @tracer.start_as_current_span("Queue Prompt") async def queue_prompt(self, prompt: PromptDict | dict,