checkpoint

This commit is contained in:
Manav Rathi
2024-09-18 15:26:07 +05:30
parent 6254fe032b
commit f37f807045
2 changed files with 20 additions and 8 deletions

View File

@@ -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.
*

View File

@@ -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));
/**