Provide both options

This commit is contained in:
Manav Rathi
2024-08-28 17:49:36 +05:30
parent cd5e40a1f5
commit 14ac034c0b
3 changed files with 25 additions and 25 deletions

View File

@@ -675,7 +675,7 @@ export default function Gallery() {
useEffect(() => {
// TODO-Cluster
if (process.env.NEXT_PUBLIC_ENTE_WIP_CL) {
if (process.env.NEXT_PUBLIC_ENTE_WIP_CL_AUTO) {
setTimeout(() => {
if (!wipHasSwitchedOnceCmpAndSet()) {
void wipClusterEnable().then(

View File

@@ -1,5 +1,5 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemGroup } from "@/base/components/Menu";
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
import { pt, ut } from "@/base/i18n";
import log from "@/base/log";
@@ -8,6 +8,7 @@ import {
enableML,
mlStatusSnapshot,
mlStatusSubscribe,
wipCluster,
wipClusterEnable,
type MLStatus,
} from "@/new/photos/services/ml";
@@ -339,9 +340,9 @@ const ManageML: React.FC<ManageMLProps> = ({
};
// TODO-Cluster
// const wipClusterNow = () => void wipCluster();
const router = useRouter();
const wipClusterNow = () => router.push("/cluster-debug");
const wipClusterNow = () => wipCluster();
const wipClusterShowNow = () => router.push("/cluster-debug");
return (
<Stack px={"16px"} py={"20px"} gap={4}>
@@ -390,17 +391,30 @@ const ManageML: React.FC<ManageMLProps> = ({
<Box>
<MenuItemGroup>
<EnteMenuItem
label={ut(
"View clusters internal only option",
)}
label={ut("Create clusters • internal only option")}
onClick={wipClusterNow}
/>
</MenuItemGroup>
{/* <MenuSectionTitle
<MenuSectionTitle
title={ut(
"Create clusters locally, afresh and in-memory. Existing local clusters will be overwritten. Nothing will be saved or synced to remote.",
"Create clusters locally, afresh and in-memory. Nothing will be saved or synced to remote. You can view the results in search dropdown.",
)}
/> */}
/>
</Box>
)}
{showClusterOpt && (
<Box>
<MenuItemGroup>
<EnteMenuItem
label={ut("View clusters • internal only option")}
onClick={wipClusterShowNow}
/>
</MenuItemGroup>
<MenuSectionTitle
title={ut(
"Variant of above that opens a page with debug info. WARNING: Unoptimized, likely will cause a crash for accounts with few k photos.",
)}
/>
</Box>
)}
</Stack>

View File

@@ -411,21 +411,7 @@ export const wipClusterDebugPageContents = async (): Promise<
return { faceFNs, clusters, clusterIDForFaceID };
};
export const wipCluster = async () => {
if (!(await wipClusterEnable())) return;
log.info("clustering");
_wip_isClustering = true;
_wip_searchPersons = undefined;
triggerStatusUpdate();
const { clusters, cgroups } = await clusterFaces(await faceIndexes());
const searchPersons = await convertToSearchPersons(clusters, cgroups);
_wip_isClustering = false;
_wip_searchPersons = searchPersons;
triggerStatusUpdate();
};
export const wipCluster = () => void wipClusterDebugPageContents();
const convertToSearchPersons = async (
clusters: FaceCluster[],