Potential entry point
This commit is contained in:
@@ -87,7 +87,7 @@ type RemoteEmbedding = z.infer<typeof RemoteEmbedding>;
|
||||
* This function should be called only after we have synced files with remote.
|
||||
* See: [Note: Ignoring embeddings for unknown files].
|
||||
*/
|
||||
export const pullEmbeddings = async (
|
||||
const pullEmbeddings = async (
|
||||
model: EmbeddingModel,
|
||||
save: (decryptedEmbedding: string) => Promise<void>,
|
||||
) => {
|
||||
|
||||
22
web/packages/new/photos/services/face/worker.ts
Normal file
22
web/packages/new/photos/services/face/worker.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { pullFaceEmbeddings } from "../embedding";
|
||||
|
||||
/**
|
||||
* Run operations related to face indexing and search in a Web Worker.
|
||||
*
|
||||
* This is a normal class that is however exposed (via comlink) as a proxy
|
||||
* running inside a Web Worker. This way, we do not bother the main thread with
|
||||
* tasks that might degrade interactivity.
|
||||
*/
|
||||
export class FaceWorker {
|
||||
private isSyncing = false;
|
||||
|
||||
/**
|
||||
* Pull embeddings from remote, and start backfilling if needed.
|
||||
*/
|
||||
async sync() {
|
||||
if (this.isSyncing) return;
|
||||
this.isSyncing = true;
|
||||
await pullFaceEmbeddings();
|
||||
this.isSyncing = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user