Provide a better error message when attempting to execute the workflow with a missing node. (#3517)

This commit is contained in:
Dr.Lt.Data 2024-05-20 19:58:46 +09:00 committed by GitHub
parent 09e069ae6c
commit 4bc1884478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -622,8 +622,17 @@ def full_type_name(klass):
def validate_prompt(prompt): def validate_prompt(prompt):
outputs = set() outputs = set()
for x in prompt: for x in prompt:
if 'class_type' not in prompt[x]:
error = {
"type": "invalid_prompt",
"message": f"Cannot execute due to a missing node",
"details": f"Node ID '#{x}'",
"extra_info": {}
}
return (False, error, [], [])
class_ = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']] class_ = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']]
if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE == True: if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE is True:
outputs.add(x) outputs.add(x)
if len(outputs) == 0: if len(outputs) == 0: