Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

new

Manav Rathi7cc29c302e8d
diff --git a/web/apps/photos/src/services/face/db.ts b/web/apps/photos/src/services/face/db.ts
index 21dd3de41d..afc9581382 100644
--- a/web/apps/photos/src/services/face/db.ts
+++ b/web/apps/photos/src/services/face/db.ts
@@ -173,6 +173,14 @@ export const saveFaceIndex = async (faceIndex: FaceIndex) => {
]);
};
+/**
+ * Return the {@link FaceIndex}, if any, for {@link fileID}.
+ */
+export const faceIndex = async (fileID: number) => {
+ const db = await faceDB();
+ return db.get("face-index", fileID);
+};
+
/**
* Record the existence of a file so that entities in the face indexing universe
* know about it (e.g. can index it if it is new and it needs indexing).
diff --git a/web/apps/photos/src/services/face/indexer.ts b/web/apps/photos/src/services/face/indexer.ts
index 2ce75bf008..cb8465d166 100644
--- a/web/apps/photos/src/services/face/indexer.ts
+++ b/web/apps/photos/src/services/face/indexer.ts
@@ -10,6 +10,7 @@ import mlWorkManager from "services/machineLearning/mlWorkManager";
import type { EnteFile } from "types/file";
import { isInternalUserForML } from "utils/user";
import {
+ faceIndex,
indexedAndIndexableCounts,
syncWithLocalIndexableFileIDs,
unindexedFileIDs,
@@ -190,8 +191,8 @@ export const faceIndexingStatus = async (): Promise<FaceIndexingStatus> => {
export const unidentifiedFaceIDs = async (
enteFile: EnteFile,
): Promise<string[]> => {
- const mlFileData = await mlIDbStorage.getFile(enteFile.id);
- return mlFileData?.faceEmbedding.faces.map((f) => f.faceID) ?? [];
+ const index = await faceIndex(enteFile.id);
+ return index?.faceEmbedding.faces.map((f) => f.faceID) ?? [];
};
/**