Delete comfy_register_nodes.py
Browse files- comfy_register_nodes.py +0 -47
comfy_register_nodes.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
|
| 4 |
-
class LoadPromptFromFileEQXNode:
|
| 5 |
-
@classmethod
|
| 6 |
-
def INPUT_TYPES(cls):
|
| 7 |
-
return {
|
| 8 |
-
"required": {
|
| 9 |
-
"file_path": ("STRING", {"default": "", "multiline": False}),
|
| 10 |
-
"seed": ("INT", {"default": 0, "min": 0, "max": 10000000}),
|
| 11 |
-
}
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
RETURN_TYPES = ("STRING", "STRING", "STRING", "INT")
|
| 15 |
-
RETURN_NAMES = ("id", "prompt", "negative_prompt", "seed")
|
| 16 |
-
FUNCTION = "load_prompt"
|
| 17 |
-
CATEGORY = "Load"
|
| 18 |
-
|
| 19 |
-
def load_prompt(self, file_path, seed):
|
| 20 |
-
if not os.path.isfile(file_path):
|
| 21 |
-
return "", "", "", seed
|
| 22 |
-
with open(file_path, 'r') as file:
|
| 23 |
-
data = file.read()
|
| 24 |
-
pattern = r"\{{{(.*?)}}}{{(.*?)}}{([^}]*?)}"
|
| 25 |
-
matches = re.finditer(pattern, data)
|
| 26 |
-
prompt_list = []
|
| 27 |
-
for match in matches:
|
| 28 |
-
prompt_list.append(match.groups())
|
| 29 |
-
if not prompt_list:
|
| 30 |
-
return "", "", "", seed
|
| 31 |
-
index = seed % len(prompt_list)
|
| 32 |
-
identificador, positive_prompt, negative_prompt = prompt_list[index]
|
| 33 |
-
seed += 1
|
| 34 |
-
return (
|
| 35 |
-
identificador.strip(),
|
| 36 |
-
positive_prompt.strip(),
|
| 37 |
-
negative_prompt.strip(),
|
| 38 |
-
seed
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
NODE_CLASS_MAPPINGS = {
|
| 42 |
-
"Load Prompt From File - EQX": LoadPromptFromFileEQXNode
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
NODE_DISPLAY_NAME_MAPPINGS = {
|
| 46 |
-
"Load Prompt From File - EQX": "Load Prompt From File - EQX"
|
| 47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|