Assuming that implementing websocket adds complexity to other systems that use ComfyUI API, having a sync HTTP endpoint that awaits the workflow to finish can be a solution.
To implement, this instructions should work:
Add POST /prompt_sync endpoint. This endpoint waits the prompt_id to be executed, adds a callback function on a map.
Add POST /prompt_finish endpoint. This endpoint triggers a callback function from a map according to prompt_id
Add node Finish workflow with image. This node trigers /prompt_finish with the image and prompt_id
Assuming that implementing websocket adds complexity to other systems that use ComfyUI API, having a sync HTTP endpoint that awaits the workflow to finish can be a solution.
To implement, this instructions should work:
POST /prompt_sync
endpoint. This endpoint waits the prompt_id to be executed, adds a callback function on a map.POST /prompt_finish
endpoint. This endpoint triggers a callback function from a map according to prompt_idFinish workflow with image
. This node trigers/prompt_finish
with the image and prompt_id