Add a button to interrupt processing to the ui.

This commit is contained in:
comfyanonymous 2023-03-02 15:24:51 -05:00
parent 69cc75fbf8
commit c8ce599a8f
3 changed files with 10 additions and 2 deletions

View File

@ -135,6 +135,8 @@ class PromptExecutor:
self.server = server self.server = server
def execute(self, prompt, extra_data={}): def execute(self, prompt, extra_data={}):
nodes.interrupt_processing(False)
if "client_id" in extra_data: if "client_id" in extra_data:
self.server.client_id = extra_data["client_id"] self.server.client_id = extra_data["client_id"]
else: else:

View File

@ -45,8 +45,8 @@ def filter_files_extensions(files, extensions):
def before_node_execution(): def before_node_execution():
model_management.throw_exception_if_processing_interrupted() model_management.throw_exception_if_processing_interrupted()
def interrupt_processing(): def interrupt_processing(value=True):
model_management.interrupt_current_processing() model_management.interrupt_current_processing(value)
class CLIPTextEncode: class CLIPTextEncode:
@classmethod @classmethod

View File

@ -796,6 +796,11 @@ function setRunningNode(id) {
(() => { (() => {
function updateStatus(data) { function updateStatus(data) {
document.getElementById("queuesize").innerHTML = "Queue size: " + (data ? data.exec_info.queue_remaining : "ERR"); document.getElementById("queuesize").innerHTML = "Queue size: " + (data ? data.exec_info.queue_remaining : "ERR");
if (data && data.exec_info.queue_remaining) {
document.getElementById("cancelcurrentjobbutton").hidden = false;
} else {
document.getElementById("cancelcurrentjobbutton").hidden = true;
}
} }
//fix for colab and other things that don't support websockets. //fix for colab and other things that don't support websockets.
@ -1083,6 +1088,7 @@ function clearItems(type) {
<button style="font-size: 10px;">Load</button> <button style="font-size: 10px;">Load</button>
<br> <br>
</div> </div>
<button style="font-size: 10px;" hidden onclick="clearItems('interrupt')" id="cancelcurrentjobbutton">Cancel Current</button><br>
<span style="left: 0%;padding: 3px;display:inline-block;">Queued:</span> <span style="left: 0%;padding: 3px;display:inline-block;">Queued:</span>
<div id="queuecontents" style="overflow-y: scroll;height: 100px;background-color: #d0d0d0;padding: 5px;"> <div id="queuecontents" style="overflow-y: scroll;height: 100px;background-color: #d0d0d0;padding: 5px;">
<a>1</a> <a>1</a>