Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rely on ML flag

Manav Rathie054247359c4
diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts
index 2debe3311b..0b50de384c 100644
--- a/web/apps/photos/src/services/searchService.ts
+++ b/web/apps/photos/src/services/searchService.ts
@@ -1,5 +1,10 @@
import { FILE_TYPE } from "@/media/file-type";
-import { isMLSupported, mlStatusSnapshot } from "@/new/photos/services/ml";
+import {
+ isMLEnabled,
+ isMLSupported,
+ mlStatusSnapshot,
+} from "@/new/photos/services/ml";
+import { clipMatches } from "@/new/photos/services/ml/clip";
import type { Person } from "@/new/photos/services/ml/people";
import { EnteFile } from "@/new/photos/types/file";
import { isDesktop } from "@/next/app";
@@ -21,6 +26,7 @@ import { getUniqueFiles } from "utils/file";
import { getFormattedDate } from "utils/search";
import { getLatestEntities } from "./entityService";
import locationSearchService, { City } from "./locationSearchService";
+import { ensureElectron } from "@/next/electron";
const DIGITS = new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
@@ -366,14 +372,12 @@ async function searchLocationTag(searchPhrase: string): Promise<LocationTag[]> {
}
const searchClip = async (
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- _searchPhrase: string,
+ searchPhrase: string,
): Promise<ClipSearchScores | undefined> => {
- // TODO-ML: clip-test
- return undefined;
- // const matches = await clipMatches(searchPhrase, ensureElectron());
- // log.debug(() => ["clip/scores", matches]);
- // return matches;
+ if (!isMLEnabled) return undefined;
+ const matches = await clipMatches(searchPhrase, ensureElectron());
+ log.debug(() => ["clip/scores", matches]);
+ return matches;
};
function convertSuggestionToSearchQuery(option: Suggestion): Search {