From 0e160f5d22785e88c0fc10f4c95154c5dbbe84eb Mon Sep 17 00:00:00 2001 From: Cameron Cordes Date: Wed, 29 Apr 2026 21:01:58 +0000 Subject: [PATCH] faces: include bbox on /faces/embeddings response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apollo's cluster suggester wants to render a *face*-cropped thumbnail for each cluster's representative — a multi-person photo with the cluster about 'one' of them was unreadable when the thumb showed the whole image. Plumbing bbox through means the UI can crop to the rep face without an extra round-trip per cluster. FaceEmbeddingRow gains bbox_x/y/w/h (Optional, mirrors the column nullability — for status='detected' rows the CHECK constraint guarantees they're populated, but the type stays nullable as documentation). list_embeddings already loaded these from the underlying FaceDetectionRow; this commit just stops dropping them when constructing the response. No DB changes; no behavior change for existing callers (the new fields are additive). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/faces.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/faces.rs b/src/faces.rs index 0d06675..769974d 100644 --- a/src/faces.rs +++ b/src/faces.rs @@ -154,6 +154,14 @@ pub struct FaceEmbeddingRow { pub model_version: String, /// base64 of 2048 bytes (512×f32 LE). pub embedding: String, + /// Normalized bbox 0..1, included so the cluster suggester UI can + /// crop a face thumbnail without an extra round-trip per cluster. + /// Shouldn't be NULL for `status='detected'` rows (CHECK constraint + /// in the migration), but the DB type is nullable so we mirror it. + pub bbox_x: Option, + pub bbox_y: Option, + pub bbox_w: Option, + pub bbox_h: Option, } #[derive(Serialize, Debug, Default)] @@ -1846,6 +1854,10 @@ async fn embeddings_handler( person_id: r.person_id, model_version: r.model_version, embedding: b64, + bbox_x: r.bbox_x, + bbox_y: r.bbox_y, + bbox_w: r.bbox_w, + bbox_h: r.bbox_h, }) .collect(); HttpResponse::Ok().json(out)