From 9a41eaceb9ea8ccb54e1012ed823314a53024d91 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 19 Feb 2026 08:08:10 +0000
Subject: [PATCH] Revised plan: focus on batch assignment and explore view
assignment
Co-authored-by: Teagan42 <2989925+Teagan42@users.noreply.github.com>
---
web/src/pages/FaceLibrary.tsx | 88 ++++++++++++++++++++++++++++++++++-
1 file changed, 87 insertions(+), 1 deletion(-)
diff --git a/web/src/pages/FaceLibrary.tsx b/web/src/pages/FaceLibrary.tsx
index 167dd9325..cbcb7c7de 100644
--- a/web/src/pages/FaceLibrary.tsx
+++ b/web/src/pages/FaceLibrary.tsx
@@ -416,6 +416,86 @@ export default function FaceLibrary() {
>
)}
+ {pageToggle === "train" && (
+ {
+ // Batch train all selected faces
+ let successCount = 0;
+ let failCount = 0;
+ const totalCount = selectedFaces.length;
+
+ selectedFaces.forEach((filename, index) => {
+ axios
+ .post(`/faces/train/${name}/classify`, {
+ training_file: filename,
+ })
+ .then((resp) => {
+ if (resp.status == 200) {
+ successCount++;
+ } else {
+ failCount++;
+ }
+
+ // Show final toast after all requests complete
+ if (index === totalCount - 1) {
+ if (successCount === totalCount) {
+ toast.success(
+ t("toast.success.batchTrainedFaces", {
+ count: successCount,
+ }),
+ {
+ position: "top-center",
+ },
+ );
+ } else if (successCount > 0) {
+ toast.warning(
+ t("toast.warning.partialBatchTrained", {
+ success: successCount,
+ total: totalCount,
+ }),
+ {
+ position: "top-center",
+ },
+ );
+ } else {
+ toast.error(
+ t("toast.error.batchTrainFailed", {
+ count: totalCount,
+ }),
+ {
+ position: "top-center",
+ },
+ );
+ }
+ setSelectedFaces([]);
+ refreshFaces();
+ }
+ })
+ .catch(() => {
+ failCount++;
+ if (index === totalCount - 1) {
+ toast.error(
+ t("toast.error.batchTrainFailed", {
+ count: totalCount,
+ }),
+ {
+ position: "top-center",
+ },
+ );
+ setSelectedFaces([]);
+ refreshFaces();
+ }
+ });
+ });
+ }}
+ >
+
+
+ )}