Expand private scene camera profiles

This commit is contained in:
2026-06-27 16:48:43 +02:00
parent 96ff37a5a0
commit 87f3645115
4 changed files with 410 additions and 11 deletions
+72
View File
@@ -86,6 +86,7 @@ import row_rendering # noqa: E402
import row_role_graph # noqa: E402
import row_route_metadata # noqa: E402
import row_subject_route # noqa: E402
import scene_camera_adapters # noqa: E402
import server_routes # noqa: E402
import sdxl_formatter # noqa: E402
import sdxl_format_route # noqa: E402
@@ -848,6 +849,33 @@ def smoke_row_camera_policy() -> None:
_expect("glass conservatory" in inline_composition.lower(), "inline profile did not drive composition cleanup")
_expect("bag" not in inline_composition.lower() and "shoes" not in inline_composition.lower(), "inline profile composition leaked unrelated props")
beach_profile = scene_camera_adapters.scene_camera_profile(
"beach cafe table with woven chairs, linen shade, and ocean light in the background",
scene_entry={"slug": "beach_cafe_table"},
)
subway_profile = scene_camera_adapters.scene_camera_profile(
"clean subway platform with tiled walls, overhead lights, and a quiet selfie corner",
scene_entry={"slug": "subway_tile_selfie_corner"},
)
apartment_profile = scene_camera_adapters.scene_camera_profile(
"sunny apartment corner with bookshelves, a warm rug, and a phone on a small tripod",
scene_entry={"slug": "sunny_apartment_phone_tripod"},
)
_expect(not beach_profile, "scene camera resolver should not classify beach cafe as business cafe")
_expect(not subway_profile, "scene camera resolver should not classify subway tile as station lockers")
_expect(not apartment_profile, "scene camera resolver should not classify apartment bookshelves as classical library")
mirror_profile = scene_camera_adapters.scene_camera_profile(
"large bedroom mirror with the phone visible, bed behind the subject, and warm side lamps",
scene_entry={"slug": "large_bedroom_mirror_selfie"},
)
studio_profile = scene_camera_adapters.scene_camera_profile(
"dark private studio with glossy black floor reflections, rim light, and a phone tripod",
scene_entry={"slug": "black_latex_studio_floor"},
)
_expect(mirror_profile.get("key") == "mirror_room", "scene slug resolver missed mirror-room profile")
_expect(studio_profile.get("key") == "private_studio", "scene slug resolver missed private-studio profile")
def smoke_config_route_location_theme() -> None:
location_config, composition_config = _classical_library_theme_configs()
@@ -958,6 +986,47 @@ def smoke_config_route_location_theme() -> None:
_expect("back-right quarter view" in parking_directive, "parking camera-scene adapter missed orbit direction")
_expect("low-angle shot" in parking_directive, "parking camera-scene adapter missed elevation")
creator_location_config, creator_composition_config = _thematic_location_configs("creator_bedroom")
creator_row = pb.build_prompt_from_configs(
row_number=1,
start_index=1,
seed=3321,
category_config=pb.build_category_config_json("woman", "random"),
cast_config=pb.build_cast_config_json("solo_woman", 1, 0),
generation_profile=pb.build_generation_profile_json(profile="balanced"),
camera_config=_orbit_camera(
horizontal_angle=45,
vertical_angle=0,
zoom=5.5,
subject_focus="environment",
),
location_config=creator_location_config,
composition_config=creator_composition_config,
)
_expect_row_base(creator_row, "config_route_location_theme.creator")
creator_scene = _expect_text("config_route_location_theme.creator_scene", creator_row.get("scene_text"), 20)
creator_composition = _expect_text("config_route_location_theme.creator_composition", creator_row.get("composition"), 10)
creator_directive = _expect_text(
"config_route_location_theme.creator_camera_scene_directive",
creator_row.get("camera_scene_directive"),
40,
)
creator_profile = creator_row.get("scene_camera_profile") if isinstance(creator_row.get("scene_camera_profile"), dict) else {}
_expect("creator" in creator_scene.lower() or "phone" in creator_scene.lower(), "creator theme did not drive scene")
_expect(
any(token in creator_composition.lower() for token in ("creator", "tripod", "phone", "bed")),
"creator theme did not drive composition",
)
_expect(creator_row.get("location_theme") == "creator_bedroom", "creator location theme did not survive")
_expect(creator_row.get("scene_theme") == "creator_bedroom", "creator scene theme did not survive")
_expect(creator_row.get("scene_camera_profile_key") == "creator_bedroom", "creator theme did not expose camera profile key")
_expect(creator_profile.get("family") == "private_creator", "creator camera profile family should be private_creator")
_expect("Creator room camera layout" in creator_directive, "creator theme did not drive camera-scene adapter")
_expect("front-right quarter view" in creator_directive, "creator camera-scene adapter missed orbit direction")
creator_krea = krea_formatter.format_krea2_prompt("", metadata_json=_json(creator_row), target="single")
creator_prompt = creator_krea.get("krea_prompt") or ""
_expect("Creator room camera layout" in creator_prompt, "Krea config route lost creator camera-scene directive")
def smoke_builder_prompt_route_policy() -> None:
def legacy_from_request(request: builder_prompt_route.PromptBuildRequest) -> dict[str, Any]:
@@ -1364,6 +1433,9 @@ def smoke_location_config_policy() -> None:
_expect(pb.LOCATION_POOL_PRESETS is location_config.LOCATION_POOL_PRESETS, "Prompt builder location presets are not delegated")
_expect(pb.COMPOSITION_POOL_PRESETS is location_config.COMPOSITION_POOL_PRESETS, "Prompt builder composition presets are not delegated")
_expect("classical_library" in location_config.location_theme_choices(), "Location themes lost classical_library")
_expect("creator_bedroom" in location_config.location_theme_choices(), "Location themes lost creator_bedroom")
_expect("mirror_room" in location_config.location_theme_choices(), "Location themes lost mirror_room")
_expect("fetish_studio" in location_config.location_theme_choices(), "Location themes lost fetish_studio")
custom = json.loads(
pb.build_location_pool_json(