Add files via upload

This commit is contained in:
Nik Clark
2025-04-01 18:57:11 +01:00
committed by GitHub
parent be096b3b86
commit 5c65dd1c8f
3 changed files with 94 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
import random
from typing import List
import comfy.model_management as model_management
class TT_StoryCombiner:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text1": ("STRING", {"multiline": True}),
"text2": ("STRING", {"multiline": True}),
"text3": ("STRING", {"multiline": True}),
"text4": ("STRING", {"multiline": True}),
"text5": ("STRING", {"multiline": True}),
"text6": ("STRING", {"multiline": True}),
"text7": ("STRING", {"multiline": True}),
"text8": ("STRING", {"multiline": True}),
"text9": ("STRING", {"multiline": True}),
"separator": ("STRING", {"default": ". "}),
"seed": ("INT", {"default": 0}),
"enhance_female_prompt": ("BOOLEAN", {"default": False})
}
}
RETURN_TYPES = ("STRING",)
FUNCTION = "process"
CATEGORY = "TT_TextTools"
def process(self, text1: str, text2: str, text3: str, text4: str, text5: str, text6: str, text7: str, text8: str, text9: str, separator: str, seed: int, enhance_female_prompt: bool) -> List[str]:
random.seed(seed)
def get_random_line(text):
lines = [line.strip() for line in text.split("\n") if line.strip()]
return random.choice(lines) if lines else ""
selected_lines = [
get_random_line(text1),
get_random_line(text2),
get_random_line(text3),
get_random_line(text4),
get_random_line(text5),
get_random_line(text6),
get_random_line(text7),
get_random_line(text8),
get_random_line(text9)
]
filtered_lines = [line for line in selected_lines if line]
result = separator.join(filtered_lines)
if enhance_female_prompt:
result += separator + "large breasts. nipples under clothes women dress style."
return (result,)
def register_nodes():
return {"TT_StoryCombiner": TT_StoryCombiner}
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"TT_StoryCombiner": TT_StoryCombiner
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"TT_StoryCombiner": "TT_StoryCombiner"
}
+17
View File
@@ -0,0 +1,17 @@
import comfy.model_management
class TT_TextInput:
@classmethod
def INPUT_TYPES(cls):
return {"required": {"text": ("STRING", {"multiline": True, "default": ""})}}
RETURN_TYPES = ("STRING",)
FUNCTION = "process"
CATEGORY = "TT_TextTools"
def process(self, text):
return (text,)
# Register the node
NODE_CLASS_MAPPINGS = {"TT_TextInput": TT_TextInput}
NODE_DISPLAY_NAME_MAPPINGS = {"TT_TextInput": "TT_Text Input"}
+6
View File
@@ -1,15 +1,21 @@
from .TT_FemaleClothes import TT_FemaleClothes
from .TT_RandomPlacesOnEarth import TT_RandomPlacesOnEarth
from .TT_CountryOfOrigin import TT_CountryOfOrigin
from .TT_StoryCombiner import TT_StoryCombiner
from .TT_TextInput import TT_TextInput
NODE_CLASS_MAPPINGS = {
"TT_FemaleClothes": TT_FemaleClothes,
"TT_RandomPlacesOnEarth": TT_RandomPlacesOnEarth,
"TT_CountryOfOrigin": TT_CountryOfOrigin,
"TT_StoryCombiner": TT_StoryCombiner,
"TT_TextInput": TT_TextInput,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"TT_FemaleClothes": "TT_FemaleClothes",
"TT_RandomPlacesOnEarth": "TT_RandomPlacesOnEarth",
"TT_CountryOfOrigin": "TT_CountryOfOrigin",
"TT_StoryCombiner": "TT_StoryCombiner",
"TT_TextInput": "TT_Text Input",
}