mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-04 10:40:30 +08:00
Merge 8824f4a372 into dd86b15521
This commit is contained in:
commit
bdc4e6dff4
37
server.py
37
server.py
@ -915,6 +915,43 @@ class PromptServer():
|
|||||||
"extra_info": {}
|
"extra_info": {}
|
||||||
}
|
}
|
||||||
return web.json_response({"error": error, "node_errors": {}}, status=400)
|
return web.json_response({"error": error, "node_errors": {}}, status=400)
|
||||||
|
|
||||||
|
@routes.post("/validate_prompt")
|
||||||
|
async def validate_prompt(request):
|
||||||
|
logging.info("validate prompt request")
|
||||||
|
json_data = await request.json()
|
||||||
|
|
||||||
|
if "prompt" not in json_data:
|
||||||
|
error = {
|
||||||
|
"type": "no_prompt",
|
||||||
|
"message": "No prompt provided",
|
||||||
|
"details": "No prompt provided",
|
||||||
|
"extra_info": {}
|
||||||
|
}
|
||||||
|
return web.json_response({"error": error, "node_errors": {}}, status=400)
|
||||||
|
|
||||||
|
prompt = json_data["prompt"]
|
||||||
|
prompt_id = str(json_data.get("prompt_id", uuid.uuid4()))
|
||||||
|
|
||||||
|
partial_execution_targets = json_data.get("partial_execution_targets", None)
|
||||||
|
|
||||||
|
is_valid, error_info, good_outputs, node_errors = await execution.validate_prompt(prompt_id, prompt, partial_execution_targets)
|
||||||
|
|
||||||
|
if is_valid:
|
||||||
|
response = {
|
||||||
|
"valid": True,
|
||||||
|
"prompt_id": prompt_id,
|
||||||
|
"outputs": good_outputs,
|
||||||
|
"node_errors": node_errors
|
||||||
|
}
|
||||||
|
return web.json_response(response)
|
||||||
|
else:
|
||||||
|
response = {
|
||||||
|
"valid": False,
|
||||||
|
"error": error_info,
|
||||||
|
"node_errors": node_errors
|
||||||
|
}
|
||||||
|
return web.json_response(response, status=400)
|
||||||
|
|
||||||
@routes.post("/queue")
|
@routes.post("/queue")
|
||||||
async def post_queue(request):
|
async def post_queue(request):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user