Manav Rathi 1 年之前
父節點
當前提交
e5a96222b9

+ 5 - 3
web/apps/photos/src/services/face/db.ts

@@ -30,7 +30,9 @@ export interface IndexStatus {
  * server ML data shape here exactly.
  */
 export interface MinimalPersistedFileData {
+    fileId: number;
     mlVersion: number;
+    errorCount: number;
     faces?: { personId?: number; id: string }[];
 }
 
@@ -42,7 +44,7 @@ const MLDATA_DB_NAME = "mldata";
 interface MLDb extends DBSchema {
     files: {
         key: number;
-        value: MlFileData;
+        value: MinimalPersistedFileData;
         indexes: { mlVersion: [number, number] };
     };
     people: {
@@ -267,7 +269,7 @@ class MLIDbStorage {
 
     public async upsertFileInTx(
         fileId: number,
-        upsert: (mlFile: MlFileData) => MlFileData,
+        upsert: (mlFile: MinimalPersistedFileData) => MinimalPersistedFileData,
     ) {
         const db = await this.db;
         const tx = db.transaction("files", "readwrite");
@@ -280,7 +282,7 @@ class MLIDbStorage {
     }
 
     public async putAllFiles(
-        mlFiles: Array<MlFileData>,
+        mlFiles: MinimalPersistedFileData[],
         tx: IDBPTransaction<MLDb, ["files"], "readwrite">,
     ) {
         await Promise.all(mlFiles.map((mlFile) => tx.store.put(mlFile)));

+ 5 - 3
web/apps/photos/src/services/machineLearning/machineLearningService.ts

@@ -1,9 +1,11 @@
 import log from "@/next/log";
 import { CustomError, parseUploadErrorCodes } from "@ente/shared/error";
 import PQueue from "p-queue";
-import mlIDbStorage, { ML_SEARCH_CONFIG_NAME } from "services/face/db";
+import mlIDbStorage, {
+    ML_SEARCH_CONFIG_NAME,
+    type MinimalPersistedFileData,
+} from "services/face/db";
 import { putFaceEmbedding } from "services/face/remote";
-import { MlFileData } from "services/face/types";
 import { getLocalFiles } from "services/fileService";
 import { EnteFile } from "types/file";
 import { isInternalUserForML } from "utils/user";
@@ -104,7 +106,7 @@ class MachineLearningService {
             fileId,
             mlVersion: 0,
             errorCount: 0,
-        } as MlFileData;
+        } as MinimalPersistedFileData;
     }
 
     private async getLocalFilesMap(syncContext: MLSyncContext) {