Potential entry point

This commit is contained in:
Manav Rathi
2024-06-27 11:51:39 +05:30
parent 7d8ade7fe4
commit ea7619d405
2 changed files with 23 additions and 1 deletions

View File

@@ -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>,
) => {

View 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;
}
}