Wrap
This commit is contained in:
@@ -2,6 +2,8 @@ import log from "@/next/log";
|
||||
import { ComlinkWorker } from "@/next/worker/comlink-worker";
|
||||
import { wait } from "@/utils/promise";
|
||||
import { type Remote } from "comlink";
|
||||
import mlIDbStorage from "services/face/db-old";
|
||||
import { defaultMLVersion } from "services/machineLearning/machineLearningService";
|
||||
import mlWorkManager from "services/machineLearning/mlWorkManager";
|
||||
import type { EnteFile } from "types/file";
|
||||
import { markIndexingFailed } from "./db";
|
||||
@@ -153,8 +155,14 @@ export interface FaceIndexingStatus {
|
||||
nTotalFiles: number;
|
||||
}
|
||||
|
||||
export const faceIndexingStatus = async (): Promise<FaceIndexingStatus> => {
|
||||
const indexStatus0 = await mlIDbStorage.getIndexStatus(defaultMLVersion);
|
||||
const indexStatus = convertToNewInterface(indexStatus0);
|
||||
return indexStatus;
|
||||
};
|
||||
|
||||
export const convertToNewInterface = (indexStatus: IndexStatus) => {
|
||||
let phase: string;
|
||||
let phase: FaceIndexingStatus["phase"];
|
||||
if (!indexStatus.localFilesSynced) {
|
||||
phase = "scheduled";
|
||||
} else if (indexStatus.outOfSyncFilesExists) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import * as chrono from "chrono-node";
|
||||
import { t } from "i18next";
|
||||
import mlIDbStorage from "services/face/db-old";
|
||||
import type { Person } from "services/face/people";
|
||||
import { defaultMLVersion } from "services/machineLearning/machineLearningService";
|
||||
import { Collection } from "types/collection";
|
||||
import { EntityType, LocationTag, LocationTagData } from "types/entity";
|
||||
import { EnteFile } from "types/file";
|
||||
@@ -22,7 +21,7 @@ import { getFormattedDate } from "utils/search";
|
||||
import { clipService, computeClipMatchScore } from "./clip-service";
|
||||
import { localCLIPEmbeddings } from "./embeddingService";
|
||||
import { getLatestEntities } from "./entityService";
|
||||
import { convertToNewInterface } from "./face/indexer";
|
||||
import { faceIndexingStatus } from "./face/indexer";
|
||||
import locationSearchService, { City } from "./locationSearchService";
|
||||
|
||||
const DIGITS = new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
|
||||
@@ -176,9 +175,7 @@ export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
|
||||
|
||||
export async function getIndexStatusSuggestion(): Promise<Suggestion> {
|
||||
try {
|
||||
const indexStatus0 =
|
||||
await mlIDbStorage.getIndexStatus(defaultMLVersion);
|
||||
const indexStatus = convertToNewInterface(indexStatus0);
|
||||
const indexStatus = await faceIndexingStatus();
|
||||
|
||||
let label: string;
|
||||
switch (indexStatus.phase) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FILE_TYPE } from "@/media/file-type";
|
||||
import { IndexStatus } from "services/face/db-old";
|
||||
import type { FaceIndexingStatus } from "services/face/indexer";
|
||||
import type { Person } from "services/face/people";
|
||||
import { City } from "services/locationSearchService";
|
||||
import { LocationTagData } from "types/entity";
|
||||
@@ -31,7 +31,7 @@ export interface Suggestion {
|
||||
| DateValue
|
||||
| number[]
|
||||
| Person
|
||||
| IndexStatus
|
||||
| FaceIndexingStatus
|
||||
| LocationTagData
|
||||
| City
|
||||
| FILE_TYPE
|
||||
|
||||
Reference in New Issue
Block a user