Handle errors from model for comfyui-json

This commit is contained in:
Lucas Armand
2025-10-08 12:00:45 -07:00
parent 0397af719d
commit 7d3be849d9
+6
View File
@@ -33,6 +33,9 @@ log = logging.getLogger(__file__)
async def generate_client_response(
client_request: web.Request, model_response: ClientResponse
) -> Union[web.Response, web.StreamResponse]:
match model_response.status:
case 200:
log.debug("SUCCESS")
# Check if the response is actually streaming based on response headers/content-type
is_streaming_response = (
model_response.content_type == "text/event-stream"
@@ -59,6 +62,9 @@ async def generate_client_response(
status=model_response.status,
content_type=model_response.content_type
)
case code:
log.debug(f"Model responded with error {code}")
return web.Response(status=code)
@dataclasses.dataclass