Optionally specify a prompt_id in /interrupt endpoint

This commit is contained in:
josephrocca 2025-05-28 02:39:48 +08:00 committed by GitHub
parent c9e1821a7b
commit 88185aeb81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -685,7 +685,14 @@ class PromptServer():
@routes.post("/interrupt")
async def post_interrupt(request):
nodes.interrupt_processing()
json_data = await request.json()
if "id" in json_data:
current_queue = self.prompt_queue.get_current_queue_volatile()
queue_running = current_queue[0]
if len(queue_running) > 0 and queue_running[0][1] == json_data["id"]:
nodes.interrupt_processing()
else:
nodes.interrupt_processing()
return web.Response(status=200)
@routes.post("/free")