From 1ec10422d75d8fb1f72458c52cfd80563612ee23 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 5 May 2025 13:20:28 -0700 Subject: [PATCH] Fix: error validating Kling image response, trying to use `"key" in` on Pydantic class instance (#147) --- comfy_api_nodes/nodes_kling.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index 2ad1f8949..a357e4bc5 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -161,8 +161,9 @@ def is_valid_video_response(response: KlingText2VideoResponse) -> bool: def is_valid_image_response(response: KlingVirtualTryOnResponse) -> bool: """Verifies that the response contains a task result with at least one image.""" return ( - "task_result" in response.data - and "images" in response.data.task_result + response.data is not None + and response.data.task_result is not None + and response.data.task_result.images is not None and len(response.data.task_result.images) > 0 )