修改
This commit is contained in:
+2
-1
@@ -64,4 +64,5 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"PreviewPrompt": "Preview Prompt",
|
||||
}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ class PreviewPrompt:
|
||||
"text": ("STRING", {"forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"unique_id": "UNIQUE_ID"
|
||||
"unique_id": "UNIQUE_ID",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -20,10 +21,12 @@ class PreviewPrompt:
|
||||
RETURN_NAMES = ("text",)
|
||||
FUNCTION = "preview"
|
||||
OUTPUT_NODE = True
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
INPUT_IS_LIST = True
|
||||
CATEGORY = "PromptWrapper"
|
||||
|
||||
def preview(self, text, unique_id=None):
|
||||
|
||||
def preview(self, text, unique_id=None, extra_pnginfo=None):
|
||||
|
||||
return {"ui": {"text": text}, "result": (text,)}
|
||||
|
||||
|
||||
|
||||
@@ -61,20 +61,22 @@ class RandomLinePrompt:
|
||||
def random_text(self, text="", seed=0, input_prompt=""):
|
||||
|
||||
output_texts = []
|
||||
if input_prompt != "":
|
||||
lines = input_prompt.split("\n")
|
||||
for line in lines:
|
||||
output_texts.append(line)
|
||||
|
||||
if text != "":
|
||||
lines = text.split("\n")
|
||||
for line in lines:
|
||||
output_texts.append(line)
|
||||
|
||||
output_prompt = ""
|
||||
output_words = []
|
||||
if input_prompt != "":
|
||||
output_words.append(input_prompt)
|
||||
|
||||
line_count = len(output_texts)
|
||||
if line_count > 0:
|
||||
line_index = seed % line_count
|
||||
output_prompt = output_texts[line_index]
|
||||
output_words.append(output_texts[line_index])
|
||||
|
||||
output_prompt = ""
|
||||
if len(output_words) > 0:
|
||||
output_prompt = ", ".join(output_words)
|
||||
|
||||
return (output_prompt, )
|
||||
Reference in New Issue
Block a user