Compact coworking layout prompts

This commit is contained in:
2026-06-25 23:27:39 +02:00
parent d4a23ad8a7
commit 4f18fcda86
+62 -14
View File
@@ -3590,22 +3590,22 @@ def _coworking_distance_detail(distance: str, profile: dict[str, str], subject_k
distance = str(distance or "").strip().lower() distance = str(distance or "").strip().lower()
subject, _pronoun = _coworking_subject_terms(subject_kind, pov_labels) subject, _pronoun = _coworking_subject_terms(subject_kind, pov_labels)
if "wide" in distance or "full-body" in distance or "full body" in distance: if "wide" in distance or "full-body" in distance or "full body" in distance:
return f"Wide crop keeps {subject}, floor aisle, table rows, and {profile['background']} readable." return "wide crop keeps floor aisle, table rows, and window depth readable"
if "close" in distance: if "close" in distance:
return f"Close crop keeps {subject} dominant while retaining one location anchor: the {profile['foreground']} or a slice of {profile['midground']}." return "close crop keeps one desk or counter anchor visible"
return f"Medium crop keeps {subject} dominant while retaining the {profile['foreground']} and one midground layer of {profile['midground']}." return f"medium crop keeps {subject} dominant"
def _coworking_elevation_detail(elevation: str, profile: dict[str, str], subject_kind: str, pov_labels: list[str] | None = None) -> str: def _coworking_elevation_detail(elevation: str, profile: dict[str, str], subject_kind: str, pov_labels: list[str] | None = None) -> str:
elevation = str(elevation or "").strip().lower() elevation = str(elevation or "").strip().lower()
_subject, pronoun = _coworking_subject_terms(subject_kind, pov_labels) _subject, pronoun = _coworking_subject_terms(subject_kind, pov_labels)
if "low-angle" in elevation: if "low-angle" in elevation:
return f"Low angle lets the {profile['foreground']} sit low and close while windows and partition seams rise behind {pronoun}." return f"low angle keeps the foreground desk edge low while windows and partitions rise behind {pronoun}"
if "elevated" in elevation: if "elevated" in elevation:
return f"Elevated angle shows tabletop surfaces, laptop rectangles, chair positions, and the walking aisle around {pronoun}." return f"elevated angle shows tabletop surfaces, laptop shapes, chairs, and walking aisle around {pronoun}"
if "high-angle" in elevation: if "high-angle" in elevation:
return f"High angle looks down over the desk grid, chairs, floor aisle, and placement of {pronoun}." return f"high angle shows the desk grid, chairs, floor aisle, and placement of {pronoun}"
return f"Eye-level angle keeps tabletop lines and glass seams straight enough to sell the {profile['place']}." return f"eye-level angle keeps tabletop lines and glass seams straight"
def _coworking_camera_scene_directive( def _coworking_camera_scene_directive(
@@ -3632,16 +3632,54 @@ def _coworking_camera_scene_directive(
if pov_labels: if pov_labels:
return ( return (
f"{profile['layout_label']} from POV: {direction_detail}. " f"{profile['layout_label']} from POV: {direction_detail}. "
f"{distance_detail} {elevation_detail} Use the multiangle camera only as first-person spatial geometry." f"{distance_detail}; {elevation_detail}; use the multiangle camera only as first-person spatial geometry."
) )
geometry = _camera_geometry_phrase(parsed) geometry = _camera_geometry_phrase(parsed)
geometry_clause = f" ({geometry})" if geometry else "" geometry_clause = f" ({geometry})" if geometry else ""
return ( return (
f"{profile['layout_label']}{geometry_clause}: {direction_detail}. " f"{profile['layout_label']}{geometry_clause}: {direction_detail}; "
f"{distance_detail} {elevation_detail}" f"{distance_detail}; {elevation_detail}."
) )
def _coworking_composition_prompt(scene_text: Any, composition: Any, subject_kind: str = "subjects") -> str:
text = str(composition or "").strip()
if not text or not _is_coworking_scene(scene_text):
return text
lower = text.lower()
if not any(term in lower for term in ("office-lobby", "office lobby", "walking composition", "outfit-check")):
return text
subject, _pronoun = _coworking_subject_terms(subject_kind)
if subject_kind == "woman":
return "coworking lounge selfie frame with the woman near a desk edge and tall-window depth behind her"
if subject_kind == "man":
return "coworking lounge portrait frame with the man near a desk edge and tall-window depth behind him"
return f"coworking lounge frame with {subject} near a desk edge and tall-window depth behind them"
def _apply_coworking_composition(row: dict[str, Any], subject_kind: str) -> dict[str, Any]:
scene_text = row.get("scene_text") or row.get("source_scene_text") or row.get("scene")
old_composition = str(row.get("composition") or "").strip()
new_composition = _coworking_composition_prompt(scene_text, old_composition, subject_kind)
if not old_composition or new_composition == old_composition:
return row
row["source_composition"] = row.get("source_composition") or old_composition
row["composition"] = new_composition
row["composition_prompt"] = _composition_prompt(new_composition)
prompt = str(row.get("prompt") or "")
replacements = (
(f"Composition: vertical {old_composition}.", f"Composition: {_composition_prompt(new_composition)}."),
(f"Composition: {old_composition}.", f"Composition: {_composition_prompt(new_composition)}."),
(f"Framed as {old_composition}.", f"Framed as {new_composition}."),
)
for old_fragment, new_fragment in replacements:
if old_fragment in prompt:
row["prompt"] = prompt.replace(old_fragment, new_fragment)
break
row["caption"] = str(row.get("caption") or "").replace(f", {old_composition},", f", {new_composition},")
return row
def _camera_scene_directive_for_context( def _camera_scene_directive_for_context(
scene_text: Any, scene_text: Any,
composition: Any, composition: Any,
@@ -3683,12 +3721,14 @@ def _apply_camera_config(row: dict[str, Any], camera_config: str | dict[str, Any
) )
if not pov_labels: if not pov_labels:
pov_labels = [str(label) for label in _list_from(row.get("pov_character_labels")) if str(label).strip()] pov_labels = [str(label) for label in _list_from(row.get("pov_character_labels")) if str(label).strip()]
subject_kind = _row_camera_subject_kind(row)
row = _apply_coworking_composition(row, subject_kind)
scene_directive, parsed = _camera_scene_directive_for_context( scene_directive, parsed = _camera_scene_directive_for_context(
row.get("scene_text") or row.get("source_scene_text") or row.get("scene"), row.get("scene_text") or row.get("source_scene_text") or row.get("scene"),
row.get("composition") or row.get("source_composition"), row.get("composition") or row.get("source_composition"),
parsed, parsed,
pov_labels, pov_labels,
_row_camera_subject_kind(row), subject_kind,
) )
row["camera_config"] = parsed row["camera_config"] = parsed
row["camera_scene_directive"] = scene_directive row["camera_scene_directive"] = scene_directive
@@ -8231,8 +8271,16 @@ def build_insta_of_pair(
hard_camera_config = _insta_camera_config_with_detail(hard_camera_config, options["camera_detail"]) hard_camera_config = _insta_camera_config_with_detail(hard_camera_config, options["camera_detail"])
soft_camera_directive, soft_camera_config = _camera_directive(soft_camera_config) soft_camera_directive, soft_camera_config = _camera_directive(soft_camera_config)
hard_camera_directive, hard_camera_config = _camera_directive(hard_camera_config) hard_camera_directive, hard_camera_config = _camera_directive(hard_camera_config)
soft_subject_kind = "woman" if options["softcore_cast"] == "solo" else "subjects"
hard_subject_kind = "couple" if hard_women_count + hard_men_count == 2 else "subjects"
soft_row = _apply_coworking_composition(soft_row, soft_subject_kind)
hard_row = _apply_coworking_composition(hard_row, hard_subject_kind)
hard_scene = soft_row["scene_text"] if options["continuity"] == "same_creator_same_room" else hard_row["scene_text"] hard_scene = soft_row["scene_text"] if options["continuity"] == "same_creator_same_room" else hard_row["scene_text"]
hard_composition = hard_row["composition"] hard_composition = _coworking_composition_prompt(hard_scene, hard_row["composition"], hard_subject_kind)
if hard_composition != hard_row["composition"]:
hard_row["source_composition"] = hard_row.get("source_composition") or hard_row["composition"]
hard_row["composition"] = hard_composition
hard_row["composition_prompt"] = _composition_prompt(hard_composition)
soft_pov_camera_labels = ( soft_pov_camera_labels = (
pov_character_labels pov_character_labels
if options["softcore_cast"] == "same_as_hardcore" if options["softcore_cast"] == "same_as_hardcore"
@@ -8243,14 +8291,14 @@ def build_insta_of_pair(
soft_row.get("composition"), soft_row.get("composition"),
soft_camera_config, soft_camera_config,
soft_pov_camera_labels, soft_pov_camera_labels,
"woman" if options["softcore_cast"] == "solo" else "subjects", soft_subject_kind,
) )
hard_camera_scene_directive, hard_camera_config = _camera_scene_directive_for_context( hard_camera_scene_directive, hard_camera_config = _camera_scene_directive_for_context(
hard_scene, hard_scene,
hard_composition, hard_composition,
hard_camera_config, hard_camera_config,
pov_character_labels, pov_character_labels,
"couple" if hard_women_count + hard_men_count == 2 else "subjects", hard_subject_kind,
) )
if soft_pov_camera_labels: if soft_pov_camera_labels:
soft_camera_directive = "" soft_camera_directive = ""