This commit is contained in:
Manav Rathi 2024-04-09 19:26:10 +05:30
parent af07de58f6
commit b02600cb42
No known key found for this signature in database
4 changed files with 12 additions and 12 deletions

View file

@ -14,7 +14,7 @@ import { EnteMenuItem } from "components/Menu/EnteMenuItem";
import { MenuItemGroup } from "components/Menu/MenuItemGroup";
import isElectron from "is-electron";
import { AppContext } from "pages/_app";
import { ClipExtractionStatus, ClipService } from "services/clipService";
import { ClipExtractionStatus, clipService } from "services/clip-service";
import { formatNumber } from "utils/number/format";
export default function AdvancedSettings({ open, onClose, onRootClose }) {
@ -51,8 +51,8 @@ export default function AdvancedSettings({ open, onClose, onRootClose }) {
useEffect(() => {
const main = async () => {
setIndexingStatus(await ClipService.getIndexingStatus());
ClipService.setOnUpdateHandler(setIndexingStatus);
setIndexingStatus(await clipService.getIndexingStatus());
clipService.setOnUpdateHandler(setIndexingStatus);
};
main();
}, []);

View file

@ -102,7 +102,7 @@ import {
} from "constants/collection";
import { SYNC_INTERVAL_IN_MICROSECONDS } from "constants/gallery";
import { AppContext } from "pages/_app";
import { ClipService } from "services/clipService";
import { clipService } from "services/clip-service";
import { constructUserIDToEmailMap } from "services/collectionService";
import downloadManager from "services/download";
import { syncEmbeddings } from "services/embeddingService";
@ -362,7 +362,7 @@ export default function Gallery() {
syncWithRemote(false, true);
}, SYNC_INTERVAL_IN_MICROSECONDS);
if (electron) {
void ClipService.setupOnFileUploadListener();
void clipService.setupOnFileUploadListener();
electron.registerForegroundEventListener(() => {
syncWithRemote(false, true);
});
@ -373,7 +373,7 @@ export default function Gallery() {
clearInterval(syncInterval.current);
if (electron) {
electron.registerForegroundEventListener(() => {});
ClipService.removeOnFileUploadListener();
clipService.removeOnFileUploadListener();
}
};
}, []);
@ -704,8 +704,8 @@ export default function Gallery() {
await syncEntities();
await syncMapEnabled();
await syncEmbeddings();
if (ClipService.isPlatformSupported()) {
void ClipService.scheduleImageEmbeddingExtraction();
if (clipService.isPlatformSupported()) {
void clipService.scheduleImageEmbeddingExtraction();
}
} catch (e) {
switch (e.message) {

View file

@ -403,7 +403,7 @@ class ClipServiceImpl {
};
}
export const ClipService = new ClipServiceImpl();
export const clipService = new ClipServiceImpl();
const getNonClipEmbeddingExtractedFiles = async (
files: EnteFile[],

View file

@ -22,7 +22,7 @@ import { getAllPeople } from "utils/machineLearning";
import { getMLSyncConfig } from "utils/machineLearning/config";
import { getFormattedDate } from "utils/search";
import mlIDbStorage from "utils/storage/mlIDbStorage";
import { ClipService, computeClipMatchScore } from "./clipService";
import { clipService, computeClipMatchScore } from "./clip-service";
import { getLocalEmbeddings } from "./embeddingService";
import { getLatestEntities } from "./entityService";
import locationSearchService, { City } from "./locationSearchService";
@ -305,7 +305,7 @@ async function getThingSuggestion(searchPhrase: string): Promise<Suggestion[]> {
async function getClipSuggestion(searchPhrase: string): Promise<Suggestion> {
try {
if (!ClipService.isPlatformSupported()) {
if (!clipService.isPlatformSupported()) {
return null;
}
@ -397,7 +397,7 @@ async function searchThing(searchPhrase: string) {
async function searchClip(searchPhrase: string): Promise<ClipSearchScores> {
const imageEmbeddings = await getLocalEmbeddings(Model.ONNX_CLIP);
const textEmbedding = await ClipService.getTextEmbedding(searchPhrase);
const textEmbedding = await clipService.getTextEmbedding(searchPhrase);
const clipSearchResult = new Map<number, number>(
(
await Promise.all(