diff --git a/web/packages/new/photos/services/ml/people.ts b/web/packages/new/photos/services/ml/people.ts index 7ab61302c9..6b2f305245 100644 --- a/web/packages/new/photos/services/ml/people.ts +++ b/web/packages/new/photos/services/ml/people.ts @@ -98,6 +98,10 @@ export interface CGroupUserEntityData { * tailored for transmission and storage. */ export interface Person { + /** + * The source of the underlying data. + */ + type: "cgroup" | "cluster"; /** * Nanoid of the underlying cgroup or {@link FaceCluster}. */ @@ -172,9 +176,6 @@ export const reconstructPeople = async (): Promise => { // in the UI. if (cgroup.isHidden) return undefined; - // Unnamed groups are also not shown. - const name = cgroup.name; - // Person faces from all the clusters assigned to this cgroup, sorted by // their score. const faces = cgroup.assigned @@ -209,7 +210,14 @@ export const reconstructPeople = async (): Promise => { displayFaceFile = highestScoringFace.file; } - return { id, name, fileIDs, displayFaceID, displayFaceFile }; + return { + type: "cgroup" as const, + id, + name: cgroup.name, + fileIDs, + displayFaceID, + displayFaceFile, + }; }); // Convert local-only clusters to people. @@ -227,6 +235,7 @@ export const reconstructPeople = async (): Promise => { ); return { + type: "cluster" as const, id: cluster.id, name: undefined, fileIDs: [...new Set(faces.map((f) => f.file.id))],