Update
Changed the compilers output to use less tokens by collapsing the json sting to a single line updated the character json with more information
This commit is contained in:
@@ -200,7 +200,7 @@ class DragosSceneCompiler:
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {
|
||||
"input_1": (PROMPT_VAR_TYPE, {"forceInput": True}),
|
||||
"input_1": ("PROMPT_VAR", {"forceInput": True}),
|
||||
},
|
||||
"hidden": {
|
||||
"output_json_string": ("STRING", {"multiline": True}),
|
||||
@@ -214,28 +214,47 @@ class DragosSceneCompiler:
|
||||
|
||||
@staticmethod
|
||||
def _unwrap_prompt_var(v):
|
||||
"""Recursively unwrap tuples from ComfyUI PROMPT_VAR_TYPE nodes."""
|
||||
depth = 0
|
||||
while isinstance(v, tuple) and len(v) == 1:
|
||||
v = v[0]
|
||||
depth += 1
|
||||
return v
|
||||
|
||||
@staticmethod
|
||||
def _compact_for_llm(text: str) -> str:
|
||||
"""
|
||||
Replace tabs and newlines with spaces and collapse multiple spaces.
|
||||
This reduces token count and improves semantic locality.
|
||||
"""
|
||||
if not text:
|
||||
return ""
|
||||
|
||||
# Replace newline and tab with space
|
||||
text = re.sub(r"[\n\t]+", " ", text)
|
||||
|
||||
# Collapse multiple spaces into one
|
||||
text = re.sub(r" {2,}", " ", text)
|
||||
|
||||
return text.strip()
|
||||
|
||||
def compile_json(self, **kwargs):
|
||||
# If hidden output exists, use it directly
|
||||
|
||||
hidden_json = kwargs.get("output_json_string")
|
||||
|
||||
if hidden_json:
|
||||
return (hidden_json,)
|
||||
compact = self._compact_for_llm(hidden_json)
|
||||
return (compact,)
|
||||
|
||||
# Otherwise, build from inputs as before
|
||||
scene = {}
|
||||
|
||||
for key, v in kwargs.items():
|
||||
unwrapped = self._unwrap_prompt_var(v)
|
||||
if isinstance(unwrapped, dict) and "name" in unwrapped and "value" in unwrapped:
|
||||
scene[unwrapped["name"]] = unwrapped["value"]
|
||||
|
||||
json_out = json.dumps(scene, indent="\t", ensure_ascii=False)
|
||||
return (json_out,)
|
||||
|
||||
compact = self._compact_for_llm(json_out)
|
||||
|
||||
return (compact,)
|
||||
|
||||
class DragosStructuredBuilderNode:
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "Dragos-SceneBuilder"
|
||||
description = "This node pack offers various ways to build json strings that is ment to be used with a LLM to generate Prompts. It also have a node that can load different prompts so that a LLM can use the json string to make the Image Prompt."
|
||||
version = "1.1.1"
|
||||
version = "1.1.2"
|
||||
license = { file = "LICENSE" }
|
||||
|
||||
[project.urls]
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"bottom-right"
|
||||
],
|
||||
"proximity_to_camera": [
|
||||
"",
|
||||
"foreground",
|
||||
"midground",
|
||||
"background",
|
||||
@@ -26,6 +27,7 @@
|
||||
"far"
|
||||
],
|
||||
"orientation": [
|
||||
"",
|
||||
"facing camera",
|
||||
"facing left",
|
||||
"facing right",
|
||||
@@ -36,37 +38,174 @@
|
||||
"three-quarter right"
|
||||
],
|
||||
"relative_to": ""
|
||||
},
|
||||
},
|
||||
"appearance": {
|
||||
"body_form": [
|
||||
"",
|
||||
"slim",
|
||||
"athletic",
|
||||
"toned",
|
||||
"curvy",
|
||||
"hourglass",
|
||||
"pear-shaped",
|
||||
"petite",
|
||||
"tall",
|
||||
"plump",
|
||||
"voluptuous",
|
||||
"other"
|
||||
],
|
||||
"face_form": [
|
||||
"",
|
||||
"oval",
|
||||
"round",
|
||||
"heart-shaped",
|
||||
"square",
|
||||
"diamond",
|
||||
"long",
|
||||
"angular",
|
||||
"soft",
|
||||
"other"
|
||||
],
|
||||
"skin": {
|
||||
"tone": [
|
||||
"",
|
||||
"pale",
|
||||
"fair",
|
||||
"tan",
|
||||
"olive",
|
||||
"brown",
|
||||
"dark",
|
||||
"ebony",
|
||||
"other"
|
||||
],
|
||||
"details": [
|
||||
"",
|
||||
"freckles",
|
||||
"moles",
|
||||
"birthmarks",
|
||||
"scars",
|
||||
"tattoos",
|
||||
"piercings",
|
||||
"clear",
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"eyes": {
|
||||
"left": {
|
||||
"color": [
|
||||
"",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"hazel",
|
||||
"gray",
|
||||
"amber",
|
||||
"other"
|
||||
],
|
||||
"shape": [
|
||||
"",
|
||||
"almond",
|
||||
"round",
|
||||
"hooded",
|
||||
"upturned",
|
||||
"downturned",
|
||||
"wide-set",
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"right": {
|
||||
"color": [
|
||||
"",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"hazel",
|
||||
"gray",
|
||||
"amber",
|
||||
"other"
|
||||
],
|
||||
"shape": [
|
||||
"",
|
||||
"almond",
|
||||
"round",
|
||||
"hooded",
|
||||
"upturned",
|
||||
"downturned",
|
||||
"wide-set",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
},
|
||||
"head_hair": {
|
||||
"presence": ["Yes", "No"],
|
||||
"style": [
|
||||
"",
|
||||
"straight",
|
||||
"wavy",
|
||||
"curly",
|
||||
"coily",
|
||||
"pixie cut",
|
||||
"bob",
|
||||
"shoulder-length",
|
||||
"long",
|
||||
"ponytail",
|
||||
"braids",
|
||||
"bun",
|
||||
"other"
|
||||
],
|
||||
"color": [
|
||||
"",
|
||||
"blonde",
|
||||
"brunette",
|
||||
"black",
|
||||
"red",
|
||||
"platinum",
|
||||
"auburn",
|
||||
"gray",
|
||||
"dyed-unnatural",
|
||||
"other"
|
||||
],
|
||||
"length": [
|
||||
"",
|
||||
"shaved",
|
||||
"short",
|
||||
"medium",
|
||||
"long",
|
||||
"very long",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
},
|
||||
"anatomy": {
|
||||
"mons_pubis": {
|
||||
"size":["small","medium","large"],
|
||||
"shape":["flat","rounded","prominent"],
|
||||
"size":["","small","medium","large"],
|
||||
"shape":["","flat","rounded","prominent"],
|
||||
"hair": {
|
||||
"presence":["yes","no"],
|
||||
"presence":["","yes","no"],
|
||||
"density":["","sparse","moderate","dense"],
|
||||
"distribution":["","none","central","full","wide"],
|
||||
"color":["","blonde","brown","black","red","gray","other"]
|
||||
}
|
||||
},
|
||||
"labia_majora": {
|
||||
"size":["small","medium","large"],
|
||||
"thickness":["thin","average","thick"],
|
||||
"symmetry":["symmetric","slightly asymmetric","asymmetric"],
|
||||
"shape":["slit","rounded","full"],
|
||||
"fullness":["flat","moderate","full"],
|
||||
"texture":["smooth","soft","wrinkled"]
|
||||
"size":["","small","medium","large"],
|
||||
"thickness":["","thin","average","thick"],
|
||||
"symmetry":["","symmetric","slightly asymmetric","asymmetric"],
|
||||
"shape":["","slit","rounded","full"],
|
||||
"fullness":["","flat","moderate","full"],
|
||||
"texture":["","smooth","soft","wrinkled"]
|
||||
},
|
||||
"labia_minora": {
|
||||
"size":["small","medium","large"],
|
||||
"length":["short","average","long"],
|
||||
"protrusion":["none","slight","moderate","prominent"],
|
||||
"symmetry":["symmetric","slightly asymmetric","asymmetric"],
|
||||
"shape":["slit","rounded","elongated"],
|
||||
"visibility":["hidden","partially visible","visible"],
|
||||
"texture":["smooth","soft","wrinkled"]
|
||||
"visibility":["","hidden","partially visible","visible"],
|
||||
"size":["","small","medium","large"],
|
||||
"length":["","short","average","long"],
|
||||
"protrusion":["","none","slight","moderate","prominent"],
|
||||
"symmetry":["","symmetric","slightly asymmetric","asymmetric"],
|
||||
"shape":["","slit","rounded","elongated"],
|
||||
"texture":["","smooth","soft","wrinkled"]
|
||||
},
|
||||
"clitoris": {
|
||||
"visibility":["hidden","partially visible","visible"],
|
||||
"visibility":["","hidden","partially visible","visible"],
|
||||
"size":["","small","medium","large"],
|
||||
"hood": {
|
||||
"coverage":["","fully covered","partially covered","exposed"],
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"bottom-right"
|
||||
],
|
||||
"proximity_to_camera": [
|
||||
"",
|
||||
"foreground",
|
||||
"midground",
|
||||
"background",
|
||||
@@ -26,6 +27,7 @@
|
||||
"far"
|
||||
],
|
||||
"orientation": [
|
||||
"",
|
||||
"facing camera",
|
||||
"facing left",
|
||||
"facing right",
|
||||
@@ -36,17 +38,117 @@
|
||||
"three-quarter right"
|
||||
],
|
||||
"relative_to": ""
|
||||
},
|
||||
},
|
||||
"appearance": {
|
||||
"body_build": [
|
||||
"",
|
||||
"slim",
|
||||
"average",
|
||||
"athletic",
|
||||
"muscular",
|
||||
"bodybuilder",
|
||||
"stocky",
|
||||
"lean",
|
||||
"lanky",
|
||||
"other"
|
||||
],
|
||||
"face_form": [
|
||||
"",
|
||||
"square",
|
||||
"oval",
|
||||
"chiseled",
|
||||
"round",
|
||||
"heart-shaped",
|
||||
"rectangular",
|
||||
"angular",
|
||||
"other"
|
||||
],
|
||||
"skin": {
|
||||
"tone": [
|
||||
"",
|
||||
"pale",
|
||||
"fair",
|
||||
"tan",
|
||||
"olive",
|
||||
"brown",
|
||||
"dark",
|
||||
"ebony",
|
||||
"other"
|
||||
],
|
||||
"details": [
|
||||
"",
|
||||
"freckles",
|
||||
"stubble",
|
||||
"scars",
|
||||
"tattoos",
|
||||
"piercings",
|
||||
"chest hair",
|
||||
"back hair",
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"head_hair": {
|
||||
"presence": ["","Yes", "No"],
|
||||
"style": [
|
||||
"",
|
||||
"short-cropped",
|
||||
"buzz cut",
|
||||
"faded",
|
||||
"slicked-back",
|
||||
"undercut",
|
||||
"messy",
|
||||
"long",
|
||||
"man-bun",
|
||||
"bald",
|
||||
"other"
|
||||
],
|
||||
"color": [
|
||||
"",
|
||||
"blonde",
|
||||
"brown",
|
||||
"black",
|
||||
"red",
|
||||
"gray",
|
||||
"salt and pepper",
|
||||
"other"
|
||||
]
|
||||
},
|
||||
"facial_hair": {
|
||||
"presence": ["","Yes", "No"],
|
||||
"style": [
|
||||
"",
|
||||
"clean-shaven",
|
||||
"stubble",
|
||||
"goatee",
|
||||
"full beard",
|
||||
"mustache",
|
||||
"mutton chops",
|
||||
"van dyke",
|
||||
"other"
|
||||
]
|
||||
}
|
||||
},
|
||||
"anatomy": {
|
||||
"gentile": {
|
||||
"genitals": {
|
||||
"size": [
|
||||
"small",
|
||||
"average",
|
||||
"large"
|
||||
],
|
||||
"body_hair":["none","sparse","moderate","dense"]
|
||||
"circumcised": [
|
||||
"",
|
||||
"yes",
|
||||
"no"
|
||||
],
|
||||
"pubic_hair": {
|
||||
"presence": ["","yes", "no"],
|
||||
"density": ["", "sparse", "moderate", "dense"],
|
||||
"style": ["", "natural", "trimmed", "shaved", "other"]
|
||||
}
|
||||
},
|
||||
|
||||
"musculature":["slim","average","athletic","muscular"]
|
||||
"physique_details": {
|
||||
"definition": ["", "soft", "toned", "ripped", "bulky"],
|
||||
"shoulder_width": ["", "narrow", "average", "broad"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user