From 2a36216359054532084be24ab9034cd08c1c8798 Mon Sep 17 00:00:00 2001
From: sharkiecodes <lanyi_stroud@brown.edu>
Date: Mon, 28 Apr 2025 21:13:31 -0400
Subject: working on autotagging

---
 src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx')

diff --git a/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx b/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx
index 28d3ccd48..bf674c025 100644
--- a/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx
+++ b/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx
@@ -158,12 +158,14 @@ export class ImageLabelBox extends ViewBoxBaseComponent<FieldViewProps>() {
         this._currentLabel = e.target.value;
     });
 
-    classifyImagesInBox = async (prompt? : string) => {
+    classifyImagesInBox = async (selectedImages? : Doc[], prompt? : string) => {
         this.startLoading();
 
+        selectedImages ??= this._selectedImages;
+
         // Converts the images into a Base64 format, afterwhich the information is sent to GPT to label them.
 
-        const imageInfos = this._selectedImages.map(async doc => {
+        const imageInfos = selectedImages.map(async doc => {
             if (!doc.$tags_chat) {
                 const url = ImageCastWithSuffix(doc[Doc.LayoutDataKey(doc)], '_o') ?? '';
                 return imageUrlToBase64(url).then(hrefBase64 =>
-- 
cgit v1.2.3-70-g09d2

