From 3ea788875d772577ab92044bc4a8397755eb4a24 Mon Sep 17 00:00:00 2001 From: Searge Date: Wed, 4 Sep 2024 11:02:34 +0200 Subject: [PATCH] Text Output node saves new text correctly in png info --- .gitignore | 1 + Searge_LLM_Node.py | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 68bc17f..18a1c11 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,4 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +/pip/cache/ diff --git a/Searge_LLM_Node.py b/Searge_LLM_Node.py index f7fa0dd..d64dfd2 100644 --- a/Searge_LLM_Node.py +++ b/Searge_LLM_Node.py @@ -186,7 +186,10 @@ class Searge_Output_Node: return { "required": { "text": (anytype, {}), - } + }, + "hidden": { + "unique_id": "UNIQUE_ID", "extra_pnginfo": "EXTRA_PNGINFO", + }, } CATEGORY = "Searge/LLM" @@ -195,7 +198,16 @@ class Searge_Output_Node: RETURN_NAMES = () OUTPUT_NODE = True - def main(self, text): + def main(self, text, unique_id=None, extra_pnginfo=None): + if unique_id is not None and extra_pnginfo is not None and len(extra_pnginfo) > 0: + workflow = None + if "workflow" in extra_pnginfo: + workflow = extra_pnginfo["workflow"] + node = None + if workflow and "nodes" in workflow: + node = next((x for x in workflow["nodes"] if str(x["id"]) == unique_id), None) + if node: + node["widgets_values"] = [str(text)] return {"ui": {"text": (str(text),)}}