mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-13 01:07:00 +08:00
add queue_summary and output request handler
This commit is contained in:
parent
1e5f0f66be
commit
fac377cf03
2
nodes.py
2
nodes.py
@ -1911,6 +1911,8 @@ def load_custom_nodes():
|
|||||||
node_paths = folder_paths.get_folder_paths("custom_nodes")
|
node_paths = folder_paths.get_folder_paths("custom_nodes")
|
||||||
node_import_times = []
|
node_import_times = []
|
||||||
for custom_node_path in node_paths:
|
for custom_node_path in node_paths:
|
||||||
|
if not os.path.exists(custom_node_path):
|
||||||
|
continue
|
||||||
possible_modules = os.listdir(os.path.realpath(custom_node_path))
|
possible_modules = os.listdir(os.path.realpath(custom_node_path))
|
||||||
if "__pycache__" in possible_modules:
|
if "__pycache__" in possible_modules:
|
||||||
possible_modules.remove("__pycache__")
|
possible_modules.remove("__pycache__")
|
||||||
|
|||||||
40
server.py
40
server.py
@ -443,6 +443,23 @@ class PromptServer():
|
|||||||
prompt_id = request.match_info.get("prompt_id", None)
|
prompt_id = request.match_info.get("prompt_id", None)
|
||||||
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
|
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
|
||||||
|
|
||||||
|
@routes.get("/output/{prompt_id}")
|
||||||
|
async def get_output_id(request):
|
||||||
|
str = request.match_info.get("prompt_id", None)
|
||||||
|
output = {}
|
||||||
|
if str is None:
|
||||||
|
return web.json_response(output)
|
||||||
|
prompt_ids = str.split(",")
|
||||||
|
for prompt_id in prompt_ids:
|
||||||
|
the_result = self.prompt_queue.get_history(prompt_id=prompt_id)
|
||||||
|
if len(the_result) == 0:
|
||||||
|
return web.json_response(output)
|
||||||
|
|
||||||
|
result_info = {'outputs': the_result[prompt_id]['outputs']}
|
||||||
|
output[prompt_id] = result_info
|
||||||
|
|
||||||
|
return web.json_response(output)
|
||||||
|
|
||||||
@routes.get("/queue")
|
@routes.get("/queue")
|
||||||
async def get_queue(request):
|
async def get_queue(request):
|
||||||
queue_info = {}
|
queue_info = {}
|
||||||
@ -451,6 +468,29 @@ class PromptServer():
|
|||||||
queue_info['queue_pending'] = current_queue[1]
|
queue_info['queue_pending'] = current_queue[1]
|
||||||
return web.json_response(queue_info)
|
return web.json_response(queue_info)
|
||||||
|
|
||||||
|
@routes.get("/queue_summary")
|
||||||
|
async def get_queue_summary(request):
|
||||||
|
queue_info = {}
|
||||||
|
current_queue = self.prompt_queue.get_current_queue()
|
||||||
|
|
||||||
|
running_queue = current_queue[0]
|
||||||
|
running_ids = list()
|
||||||
|
for queue in running_queue:
|
||||||
|
prompt_id = queue[1]
|
||||||
|
running_ids.append(prompt_id)
|
||||||
|
running_info = {'prompt_id': prompt_id, 'current_node_id': self.last_node_id}
|
||||||
|
queue_info['running_status'] = running_info
|
||||||
|
|
||||||
|
pending_queue = current_queue[1]
|
||||||
|
pending_ids = list()
|
||||||
|
for queue in pending_queue:
|
||||||
|
pending_ids.append(queue[1])
|
||||||
|
|
||||||
|
queue_info['queue_running'] = running_ids
|
||||||
|
queue_info['queue_pending'] = pending_ids
|
||||||
|
return web.json_response(queue_info)
|
||||||
|
|
||||||
|
|
||||||
@routes.post("/prompt")
|
@routes.post("/prompt")
|
||||||
async def post_prompt(request):
|
async def post_prompt(request):
|
||||||
print("got prompt")
|
print("got prompt")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user