From 205b240a89d1c8dcef0c6bb36f855e01fd0c0989 Mon Sep 17 00:00:00 2001 From: Max Tretikov Date: Fri, 14 Jun 2024 14:47:54 -0600 Subject: [PATCH] Add an exception if history API can't be reached --- comfy/client/aio_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/client/aio_client.py b/comfy/client/aio_client.py index 89ad8d6be..aa53d9d70 100644 --- a/comfy/client/aio_client.py +++ b/comfy/client/aio_client.py @@ -11,6 +11,7 @@ from aiohttp import WSMessage, ClientResponse from typing_extensions import Dict from .client_types import V1QueuePromptResponse +from ..api.schemas import immutabledict from ..api.components.schema.prompt import PromptDict from ..api.api_client import JSONEncoder from ..api.components.schema.prompt_request import PromptRequest @@ -106,7 +107,9 @@ class AsyncRemoteComfyClient: break async with session.get(urljoin(self.server_address, "/history")) as response: if response.status == 200: - history_json = GetHistoryDict.validate(await response.json()) + history_json = immutabledict(GetHistoryDict.validate(await response.json())) + else: + raise RuntimeError("Couldn't get history") # images have filename, subfolder, type keys # todo: use the OpenAPI spec for this when I get around to updating it