Tune hardcore detail density

This commit is contained in:
2026-06-24 17:42:11 +02:00
parent e2bdff6075
commit fb6d99ac20
7 changed files with 206 additions and 19 deletions
+25
View File
@@ -178,6 +178,7 @@ CHARACTER_DESCRIPTOR_DETAIL_CHOICES = ["auto", "full", "medium", "compact", "min
CHARACTER_RANDOM_TOKENS = {"", "random", "auto", "global", "from_global", "default"}
CAMERA_DETAIL_CHOICES = ["off", "compact", "full"]
HARDCORE_DETAIL_DENSITY_CHOICES = ["compact", "balanced", "dense"]
GENERIC_POSITIVE_SUFFIX = (
"Use crisp clean comic linework, detailed hatching, soft blended shading, "
@@ -1440,6 +1441,10 @@ def camera_detail_choices() -> list[str]:
return list(CAMERA_DETAIL_CHOICES)
def hardcore_detail_density_choices() -> list[str]:
return list(HARDCORE_DETAIL_DENSITY_CHOICES)
def camera_shot_choices() -> list[str]:
return list(CAMERA_SHOT_PROMPTS)
@@ -3785,7 +3790,11 @@ def build_insta_of_options_json(
hardcore_expression_intensity: float = 0.85,
softcore_expression_enabled: bool = True,
hardcore_expression_enabled: bool = True,
hardcore_detail_density: str = "balanced",
) -> str:
hardcore_detail_density = (
hardcore_detail_density if hardcore_detail_density in HARDCORE_DETAIL_DENSITY_CHOICES else "balanced"
)
return json.dumps(
{
"softcore_cast": softcore_cast,
@@ -3804,6 +3813,7 @@ def build_insta_of_options_json(
"hardcore_expression_enabled": not _is_false(hardcore_expression_enabled),
"softcore_expression_intensity": _clamped_float(softcore_expression_intensity, 0.45),
"hardcore_expression_intensity": _clamped_float(hardcore_expression_intensity, 0.85),
"hardcore_detail_density": hardcore_detail_density,
},
ensure_ascii=True,
sort_keys=True,
@@ -3828,6 +3838,7 @@ def _parse_insta_of_options(options_json: str | dict[str, Any] | None) -> dict[s
"hardcore_expression_enabled": True,
"softcore_expression_intensity": 0.45,
"hardcore_expression_intensity": 0.85,
"hardcore_detail_density": "balanced",
}
if not options_json:
return defaults
@@ -3869,6 +3880,11 @@ def _parse_insta_of_options(options_json: str | dict[str, Any] | None) -> dict[s
parsed.get("hardcore_expression_intensity"),
defaults["hardcore_expression_intensity"],
)
parsed["hardcore_detail_density"] = (
parsed["hardcore_detail_density"]
if parsed.get("hardcore_detail_density") in HARDCORE_DETAIL_DENSITY_CHOICES
else defaults["hardcore_detail_density"]
)
for key in ("hardcore_women_count", "hardcore_men_count"):
try:
parsed[key] = max(0, min(12, int(parsed[key])))
@@ -4153,6 +4169,7 @@ def build_insta_of_pair(
expression_intensity=options["hardcore_expression_intensity"],
character_cast=character_cast or "",
)
hard_row["hardcore_detail_density"] = options["hardcore_detail_density"]
descriptor = _insta_of_descriptor(soft_row)
cast_descriptors = _insta_of_cast_descriptors(
@@ -4220,6 +4237,12 @@ def build_insta_of_pair(
options["hardcore_clothing_continuity"],
soft_row["item"],
)
hard_detail_density = options["hardcore_detail_density"]
hard_detail_directive = {
"compact": "Use one compact position-first sexual action sentence; avoid repeated aftermath wording. ",
"balanced": "",
"dense": "Use dense but coherent motion, contact, and aftermath detail while keeping one readable body position. ",
}[hard_detail_density]
soft_descriptor_sentence = (
f"Cast descriptors: {soft_cast_descriptor_text}. "
if options["softcore_cast"] == "same_as_hardcore"
@@ -4249,6 +4272,7 @@ def build_insta_of_pair(
f"Setting: {hard_scene}. "
f"{_labeled_expression_sentence('Facial expressions', hard_row.get('expression'))}"
f"Composition: {hard_composition}. "
f"{hard_detail_directive}"
f"{hard_camera_sentence}"
f"{hard_row['positive_suffix']}."
)
@@ -4294,6 +4318,7 @@ def build_insta_of_pair(
"shared_cast_descriptors": cast_descriptors,
"softcore_partner_styling": soft_partner_styling,
"hardcore_clothing_state": hard_clothing_state,
"hardcore_detail_density": hard_detail_density,
"softcore_prompt": soft_prompt,
"hardcore_prompt": hard_prompt,
"softcore_negative_prompt": soft_negative,