From 9fc0c2b4a2b5d631466da068e9d5d55a5ce5174e Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 21 Aug 2024 16:34:25 -0700 Subject: [PATCH] chore: upload node data --- custom_routes.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/custom_routes.py b/custom_routes.py index ecf9e67..3d53de0 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -989,17 +989,22 @@ async def send_json_override(self, event, data, sid=None): # await update_run_with_output(prompt_id, data) if event == 'executed' and 'node' in data and 'output' in data: + node_meta = None if prompt_id in prompt_metadata: node = data.get('node') class_type = prompt_metadata[prompt_id].workflow_api[node]['class_type'] logger.info(f"Executed {class_type} {data}") + node_meta = { + "node_id": node, + "node_class": class_type, + } if class_type == "PreviewImage": logger.info("Skipping preview image") return else: logger.info(f"Executed {data}") - await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node')) + await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node'), node_meta=node_meta) # await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node')) # update_run_with_output(prompt_id, data.get('output')) @@ -1312,7 +1317,7 @@ async def upload_in_background(prompt_id: str, data, node_id=None, have_upload=T except Exception as e: await handle_error(prompt_id, data, e) -async def update_run_with_output(prompt_id, data, node_id=None): +async def update_run_with_output(prompt_id, data, node_id=None, node_meta=None): if prompt_id not in prompt_metadata: return @@ -1323,7 +1328,8 @@ async def update_run_with_output(prompt_id, data, node_id=None): body = { "run_id": prompt_id, - "output_data": data + "output_data": data, + "node_meta": node_meta, } have_upload_media = 'images' in data or 'files' in data or 'gifs' in data or 'mesh' in data if bypass_upload and have_upload_media: