Skip to content

armgit / ente

Public Imported from GitHub
0

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

checkpoint

Manav Rathif37f807045f0
diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.ts
index fbb22f7d50..2a1407b95c 100644
--- a/web/packages/new/photos/services/ml/index.ts
+++ b/web/packages/new/photos/services/ml/index.ts
@@ -17,8 +17,9 @@ import { throttled } from "@/utils/promise";
import { proxy, transfer } from "comlink";
import { isInternalUser } from "../feature-flags";
import { getRemoteFlag, updateRemoteFlag } from "../remote-store";
+import { setSearchPeople } from "../search";
import type { UploadItem } from "../upload/types";
-import { syncCGroups, updatePeople } from "./cgroups";
+import { syncCGroups, updatedPeople, type Person } from "./cgroups";
import {
type ClusterFace,
type ClusteringOpts,
@@ -303,11 +304,11 @@ export const mlStatusSync = async () => {
* least once prior to calling this in the sync sequence.
*/
export const mlSync = async () => {
- if (!isMLSupported) return;
- if (!_state.isMLEnabled) return;
- await Promise.all([worker().then((w) => w.sync()), syncCGroups()]).then(
- () => updatePeople(),
- );
+ if (_state.isMLEnabled) {
+ await Promise.all([worker().then((w) => w.sync()), syncCGroups()]).then(
+ updatePeople,
+ );
+ }
};
/**
@@ -436,7 +437,7 @@ export const wipClusterDebugPageContents = async (
id: cgroup.id,
name: cgroup.name,
faceIDs,
- files: [...new Set(fileIDs)],
+ fileIDs: [...new Set(fileIDs)],
displayFaceID: faceID,
displayFaceFile: file,
};
@@ -661,6 +662,17 @@ const getPeople = async (): Promise<Person[] | undefined> => {
return _wip_people;
};
+/**
+ * Update our in-memory list of people, also notifying the search subsystem of
+ * the update.
+ */
+const updatePeople = async () => {
+ const people = await updatedPeople();
+ // TODO-Cluster:
+ // _wip_people = people;
+ setSearchPeople(people);
+};
+
/**
* Use CLIP to perform a natural language search over image embeddings.
*
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.ts
index 0d3273484e..4cee3026f2 100644
--- a/web/packages/new/photos/services/search/index.ts
+++ b/web/packages/new/photos/services/search/index.ts
@@ -60,7 +60,7 @@ export const setSearchCollectionsAndFiles = (cf: SearchCollectionsAndFiles) =>
/**
* Set the people that we should search across.
*/
-export const setPeople = (people: Person[]) =>
+export const setSearchPeople = (people: Person[]) =>
void worker().then((w) => w.setPeople(people));
/**