Reduce scope
This commit is contained in:
parent
f692638ede
commit
5c92bc5b89
2 changed files with 7 additions and 7 deletions
|
@ -6,7 +6,6 @@ import { t } from "i18next";
|
|||
import React, { useEffect, useState } from "react";
|
||||
import mlIDbStorage from "services/face/db";
|
||||
import type { Person } from "services/face/people";
|
||||
import type { Face, MlFileData } from "services/face/types";
|
||||
import { EnteFile } from "types/file";
|
||||
|
||||
const FaceChipContainer = styled("div")`
|
||||
|
@ -107,7 +106,7 @@ export function UnidentifiedFaces(props: {
|
|||
file: EnteFile;
|
||||
updateMLDataIndex: number;
|
||||
}) {
|
||||
const [faces, setFaces] = useState<Face[]>([]);
|
||||
const [faces, setFaces] = useState<{ id: string }[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
let didCancel = false;
|
||||
|
@ -190,7 +189,7 @@ const FaceCropImageView: React.FC<FaceCropImageViewProps> = ({ faceID }) => {
|
|||
|
||||
async function getPeopleList(file: EnteFile): Promise<Person[]> {
|
||||
let startTime = Date.now();
|
||||
const mlFileData: MlFileData = await mlIDbStorage.getFile(file.id);
|
||||
const mlFileData = await mlIDbStorage.getFile(file.id);
|
||||
log.info(
|
||||
"getPeopleList:mlFilesStore:getItem",
|
||||
Date.now() - startTime,
|
||||
|
@ -222,8 +221,8 @@ async function getPeopleList(file: EnteFile): Promise<Person[]> {
|
|||
return peopleList;
|
||||
}
|
||||
|
||||
async function getUnidentifiedFaces(file: EnteFile): Promise<Array<Face>> {
|
||||
const mlFileData: MlFileData = await mlIDbStorage.getFile(file.id);
|
||||
async function getUnidentifiedFaces(file: EnteFile): Promise<{ id: string }[]> {
|
||||
const mlFileData = await mlIDbStorage.getFile(file.id);
|
||||
|
||||
return mlFileData?.faces?.filter(
|
||||
(f) => f.personId === null || f.personId === undefined,
|
||||
|
|
|
@ -29,8 +29,9 @@ export interface IndexStatus {
|
|||
* and new types during the migration will have. Eventually we'll store the the
|
||||
* server ML data shape here exactly.
|
||||
*/
|
||||
export interface MinimalFileData {
|
||||
export interface MinimalPersistedFileData {
|
||||
mlVersion: number;
|
||||
faces?: { personId?: number; id: string }[];
|
||||
}
|
||||
|
||||
interface Config {}
|
||||
|
@ -254,7 +255,7 @@ class MLIDbStorage {
|
|||
return fileIds;
|
||||
}
|
||||
|
||||
public async getFile(fileId: number) {
|
||||
public async getFile(fileId: number): Promise<MinimalPersistedFileData> {
|
||||
const db = await this.db;
|
||||
return db.get("files", fileId);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue