This commit is contained in:
justumen
2025-02-27 18:00:12 +01:00
parent 6a21e32a42
commit 10263f2110
38 changed files with 1965 additions and 432 deletions

View File

@@ -1,4 +1,6 @@
class CombineTexts:
SPECIAL_PREFIX = "ImSpEcIaL" # The special text (password) to look for
@classmethod
def INPUT_TYPES(cls):
return {
@@ -25,11 +27,22 @@ class CombineTexts:
else:
return str(item)
combined_text = self.get_delimiter(delimiter).join([
flatten(kwargs[f"text_{i}"])
# Check each input for the special prefix
for i in range(1, number_of_inputs + 1):
text_key = f"text_{i}"
if text_key in kwargs:
text = flatten(kwargs[text_key])
if text.startswith(self.SPECIAL_PREFIX):
# Output only the text after the prefix, stripping leading whitespace
return (text[len(self.SPECIAL_PREFIX):].lstrip(),)
# If no prefix is found, combine all non-empty inputs as usual
text_entries = [
flatten(kwargs.get(f"text_{i}", ""))
for i in range(1, number_of_inputs + 1)
if f"text_{i}" in kwargs
])
if f"text_{i}" in kwargs and flatten(kwargs.get(f"text_{i}", "")).strip() != ""
]
combined_text = self.get_delimiter(delimiter).join(text_entries)
return (combined_text,)
@staticmethod