From efaef3cfa62ff2dc34269398efafdd5bb71ccb55 Mon Sep 17 00:00:00 2001 From: zer0gear Date: Mon, 11 Nov 2024 13:32:20 -0600 Subject: [PATCH] Update List Concat Node to allow combination of arbitrary number of list elements --- list_concat_node.py | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/list_concat_node.py b/list_concat_node.py index d257d57..45013cf 100644 --- a/list_concat_node.py +++ b/list_concat_node.py @@ -4,7 +4,7 @@ class ListConcatNode: return { "required": { "input_list": ("*", {"tooltip": "The list of strings to concatenate"}), - "combine_last_three_items": (["FALSE", "TRUE"], {"tooltip": "If TRUE, the last three items in the list will be combined before concatenating, useful for when using LORAs"}), + "combine_last_x_items": ("INT", {"default": 1, "min": 1, "max": 999, "tooltip": "If greater than 1, the last X items in the list will be combined before concatenating. Useful for correcting unnecessary separators."}), "separator": ("STRING", {"default": " BREAK ", "tooltip": "The separator to use when concatenating the list"}), } } @@ -17,8 +17,8 @@ class ListConcatNode: INPUT_IS_LIST = True FUNCTION = "concat_list_with_separator" CATEGORY = "text utility" - def concat_list_with_separator(self, input_list, combine_last_three_items, separator): - # If combine_last_three_items is TRUE, combine the last three items in the list before concating - if combine_last_three_items[0] == "TRUE": - input_list[-3:] = ["".join(input_list[-3:])] + def concat_list_with_separator(self, input_list, combine_last_x_items, separator): + # If combine_last_x_items is greater than 1, combine the last X items in the list + if combine_last_x_items[0] > 1: + input_list[-combine_last_x_items[0]:] = ["".join(input_list[-combine_last_x_items[0]:])] return (separator[0].join(input_list),) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d99b545..961b3f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "zer0gear-comfy-utilities" description = "Nodes: ListConcat with custom separator, Multiline String" -version = "1.1.0" # Custom Node version. Must be semantically versioned. +version = "2.0.0" # Custom Node version. Must be semantically versioned. license = { file = "LICENSE.txt" } dependencies = [] # Filled in from requirements.txt