Disambiguate implementations

This commit is contained in:
Manav Rathi
2024-10-15 16:44:51 +05:30
parent 358f741d7d
commit b2b649d203
5 changed files with 13 additions and 10 deletions

View File

@@ -12,9 +12,12 @@ import {
import { useIsSmallWidth } from "@/base/hooks";
import { pt } from "@/base/i18n";
import log from "@/base/log";
import { deleteCGroup, renameCGroup } from "@/new/photos/services/ml";
import {
deleteCGroup,
renameCGroup,
suggestionsAndChoicesForPerson,
} from "@/new/photos/services/ml";
import {
type CGroupPerson,
type ClusterPerson,
type Person,

View File

@@ -133,7 +133,7 @@ const normalized = (embedding: Float32Array) => {
* The result can also be `undefined`, which indicates that the download for the
* ML model is still in progress (trying again later should succeed).
*/
export const clipMatches = async (
export const _clipMatches = async (
searchPhrase: string,
electron: ElectronMLWorker,
): Promise<CLIPMatches | undefined> => {

View File

@@ -62,7 +62,7 @@ export type ClusterFace = Omit<Face, "embedding"> & {
* other interactions with the worker (where this code runs) do not get stalled
* while clustering is in progress.
*/
export const clusterFaces = async (
export const _clusterFaces = async (
faceIndexes: FaceIndex[],
localFiles: EnteFile[],
onProgress: (progress: ClusteringProgress) => void,

View File

@@ -360,7 +360,7 @@ export interface PersonSuggestionsAndChoices {
/**
* Returns suggestions and existing choices for the given person.
*/
export const suggestionsAndChoicesForPerson = async (
export const _suggestionsAndChoicesForPerson = async (
person: CGroupPerson,
): Promise<PersonSuggestionsAndChoices> => {
const startTime = Date.now();

View File

@@ -18,14 +18,14 @@ import {
type ImageBitmapAndData,
} from "./blob";
import {
_clipMatches,
clearCachedCLIPIndexes,
clipIndexingVersion,
clipMatches,
indexCLIP,
type CLIPIndex,
} from "./clip";
import {
clusterFaces,
_clusterFaces,
reconcileClusters,
type ClusteringProgress,
} from "./cluster";
@@ -44,7 +44,7 @@ import {
type RawRemoteMLData,
type RemoteMLData,
} from "./ml-data";
import { suggestionsAndChoicesForPerson, type CGroupPerson } from "./people";
import { _suggestionsAndChoicesForPerson, type CGroupPerson } from "./people";
import type { CLIPMatches, MLWorkerDelegate } from "./worker-types";
/**
@@ -207,7 +207,7 @@ export class MLWorker {
* Find {@link CLIPMatches} for a given normalized {@link searchPhrase}.
*/
async clipMatches(searchPhrase: string): Promise<CLIPMatches | undefined> {
return clipMatches(searchPhrase, ensure(this.electron));
return _clipMatches(searchPhrase, ensure(this.electron));
}
private async tick() {
@@ -326,7 +326,7 @@ export class MLWorker {
* cgroups if needed.
*/
async clusterFaces(masterKey: Uint8Array) {
const clusters = await clusterFaces(
const clusters = await _clusterFaces(
await savedFaceIndexes(),
await getAllLocalFiles(),
(progress) => this.updateClusteringProgress(progress),
@@ -344,7 +344,7 @@ export class MLWorker {
* Return suggestions and choices for the given cgroup {@link person}.
*/
async suggestionsAndChoicesForPerson(person: CGroupPerson) {
return suggestionsAndChoicesForPerson(person);
return _suggestionsAndChoicesForPerson(person);
}
}