Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Align /prompt response schema (#7423)

Chenlei Hue8345a9b7be8
diff --git a/execution.py b/execution.py
index fcb4f6f40..41686888f 100644
--- a/execution.py
+++ b/execution.py
@@ -775,7 +775,7 @@ def validate_prompt(prompt):
"details": f"Node ID '#{x}'",
"extra_info": {}
}
- return (False, error, [], [])
+ return (False, error, [], {})
class_type = prompt[x]['class_type']
class_ = nodes.NODE_CLASS_MAPPINGS.get(class_type, None)
@@ -786,7 +786,7 @@ def validate_prompt(prompt):
"details": f"Node ID '#{x}'",
"extra_info": {}
}
- return (False, error, [], [])
+ return (False, error, [], {})
if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE is True:
outputs.add(x)
@@ -798,7 +798,7 @@ def validate_prompt(prompt):
"details": "",
"extra_info": {}
}
- return (False, error, [], [])
+ return (False, error, [], {})
good_outputs = set()
errors = []
diff --git a/server.py b/server.py
index 76a99167d..95092d595 100644
--- a/server.py
+++ b/server.py
@@ -657,7 +657,13 @@ class PromptServer():
logging.warning("invalid prompt: {}".format(valid[1]))
return web.json_response({"error": valid[1], "node_errors": valid[3]}, status=400)
else:
- return web.json_response({"error": "no prompt", "node_errors": []}, status=400)
+ error = {
+ "type": "no_prompt",
+ "message": "No prompt provided",
+ "details": "No prompt provided",
+ "extra_info": {}
+ }
+ return web.json_response({"error": error, "node_errors": {}}, status=400)
@routes.post("/queue")
async def post_queue(request):