diff --git a/CHANGELOG.md b/CHANGELOG.md index 492299a..28dbc68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # nightly +- Add `Simple Remove Think` node # v1.0.6 - Add `Simple Auto Bypass` node - Fix "always run" mode for `Simple Lora Loader` diff --git a/nodes/nodes.py b/nodes/nodes.py index 8d796ca..7705c56 100644 --- a/nodes/nodes.py +++ b/nodes/nodes.py @@ -902,6 +902,33 @@ class AutoBypassNode: ################################ +class RemoveThinkNode: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "text": ("STRING", {"multiline": True, "forceInput": True}), + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("cleaned_text",) + FUNCTION = "process" + CATEGORY = "📚 SimpleButcher" + DESCRIPTION = "Remove ... section in text" + + def process(self, text): + + # remove ... + cleaned = re.sub(r'.*?', '', text, flags=re.DOTALL) + + cleaned = '\n'.join([line for line in cleaned.split('\n') if line.strip()]) + + return (cleaned,) + + +################################ + NODE_CLASS_MAPPINGS = { "Simple Load Line From Text File": SimpleLoadLineFromTextFile, "Simple Extract Lora From Text": SimpleExtractLoraFromText, @@ -910,6 +937,7 @@ NODE_CLASS_MAPPINGS = { "Simple Load Image With Metadata": SimpleLoadImageWithMetadataString, "Simple Load Images from Dir": SimpleLoadImagesFromDir, "Simple Auto Bypass": AutoBypassNode, + "Simple Remove Think": RemoveThinkNode, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -920,5 +948,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "Simple Load Image With Metadata": "Simple Load Image With Metadata 📚", "Simple Load Images From Dir": "Simple Load Images From Dir 📚", "Simple Auto Bypass": "Simple Auto Bypass 📚", + "Simple Remove Think": "Simple Remove Think 📚", }