[object Object]

← back to Wallco Ai

refresh_designs_snapshot: admit all gemini-%image% generators (was 2.5-only, blocked Nano Banana 3.x) + handle room_mockups list-or-dict (was crashing the build)

f7b76ddff41f4c256dee971784c02aa75c85576c · 2026-06-03 09:06:48 -0700 · Steve

Files touched

Diff

commit f7b76ddff41f4c256dee971784c02aa75c85576c
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jun 3 09:06:48 2026 -0700

    refresh_designs_snapshot: admit all gemini-%image% generators (was 2.5-only, blocked Nano Banana 3.x) + handle room_mockups list-or-dict (was crashing the build)
---
 scripts/refresh_designs_snapshot.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/refresh_designs_snapshot.py b/scripts/refresh_designs_snapshot.py
index 6d782ca..22b05a6 100644
--- a/scripts/refresh_designs_snapshot.py
+++ b/scripts/refresh_designs_snapshot.py
@@ -232,7 +232,7 @@ rows = psql_json(
     # ("these are murals.. edges modeled are ok", 2026-05-28). Allow pil-edge-heal
     # through for mural/scenic categories ONLY; tile categories stay hard-blocked.
     "FROM spoon_all_designs WHERE ("
-    "generator LIKE 'replicate%' OR generator LIKE 'gemini-2.5-flash-image%' "
+    "generator LIKE 'replicate%' OR generator LIKE 'gemini-%image%' "
     "OR generator LIKE 'pil-%' OR generator LIKE 'svg-%' OR generator IN ('comfy','flux')"
     ") AND (generator NOT IN ('pil-mid-heal','pil-edge-heal') "
     "       OR (generator = 'pil-edge-heal' AND (category ILIKE '%mural%' OR category ILIKE '%scenic%'))) "
@@ -306,7 +306,15 @@ for r in rows:
         "user_stars":      r.get('user_stars'),
         # Render-ready URL list — server-side disk paths flipped to /designs/room/:id/:room.
         # Snapshot only stores room types; server resolves the file from disk at request time.
-        "room_mockups": sorted(list((r.get('room_mockups') or {}).keys())),
+        # room_mockups may be a dict {room_type: url} OR a list (of room-type
+        # strings or {room_type:...} objects) depending on how the row was written.
+        # Handle both so one bad-shaped row can't crash the whole snapshot build.
+        "room_mockups": (
+            sorted((r.get('room_mockups') or {}).keys()) if isinstance(r.get('room_mockups'), dict)
+            else sorted({ (x.get('room_type') if isinstance(x, dict) else x) for x in (r.get('room_mockups') or []) if x })
+            if isinstance(r.get('room_mockups'), list)
+            else []
+        ),
         # Extracted edges-agent flag (NULL when clean). Drives the admin red-outline
         # treatment + the per-design "why this is not active" tooltip. Format:
         #   "EDGES_FAIL: lens=top:78.6,bottom:78.6 max=78.6 grid=mids_only ts=..."

← 52b7c2f mural-batch: curate-monterey-batch.py → 12 hue-spread publis  ·  back to Wallco Ai  ·  global search: live typeahead overlay consuming /api/search fe7ac02 →