mirror of
https://github.com/open-webui/open-webui.git
synced 2026-01-02 06:35:20 +00:00
refac/fix: comfyui filter output node type
Co-Authored-By: Paul <239564541+mirrordna-reflection-protocol@users.noreply.github.com>
This commit is contained in:
parent
c02451178c
commit
aaea9a5956
1 changed files with 12 additions and 8 deletions
|
|
@ -64,8 +64,8 @@ def get_history(prompt_id, base_url, api_key):
|
|||
return json.loads(response.read())
|
||||
|
||||
|
||||
def get_images(ws, prompt, client_id, base_url, api_key):
|
||||
prompt_id = queue_prompt(prompt, client_id, base_url, api_key)["prompt_id"]
|
||||
def get_images(ws, workflow, client_id, base_url, api_key):
|
||||
prompt_id = queue_prompt(workflow, client_id, base_url, api_key)["prompt_id"]
|
||||
output_images = []
|
||||
while True:
|
||||
out = ws.recv()
|
||||
|
|
@ -81,12 +81,16 @@ def get_images(ws, prompt, client_id, base_url, api_key):
|
|||
history = get_history(prompt_id, base_url, api_key)[prompt_id]
|
||||
for node_id in history["outputs"]:
|
||||
node_output = history["outputs"][node_id]
|
||||
if "images" in node_output:
|
||||
for image in node_output["images"]:
|
||||
url = get_image_url(
|
||||
image["filename"], image["subfolder"], image["type"], base_url
|
||||
)
|
||||
output_images.append({"url": url})
|
||||
if node_id in workflow and workflow[node_id].get("class_type") in [
|
||||
"SaveImage",
|
||||
"PreviewImage",
|
||||
]:
|
||||
if "images" in node_output:
|
||||
for image in node_output["images"]:
|
||||
url = get_image_url(
|
||||
image["filename"], image["subfolder"], image["type"], base_url
|
||||
)
|
||||
output_images.append({"url": url})
|
||||
return {"data": output_images}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue