From 05845fa3e5a6d71a58845d058a15233ccf6d72c0 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 11 Jun 2025 13:01:44 -0400 Subject: refactor unwrapPlaceholder duplicated code to DocUtils. --- src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 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 038b1c6f9..e3a3f9b05 100644 --- a/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx +++ b/src/client/views/collections/collectionFreeForm/ImageLabelBox.tsx @@ -158,10 +158,9 @@ export class ImageLabelBox extends ViewBoxBaseComponent() { this._currentLabel = e.target.value; }); - classifyImagesInBox = async (selectedImages? : Doc[], prompt? : string) => { + classifyImagesInBox = async () => { this.startLoading(); - alert('Classifying images...'); - selectedImages ??= this._selectedImages; + const selectedImages = this._selectedImages; // Converts the images into a Base64 format, afterwhich the information is sent to GPT to label them. @@ -170,7 +169,7 @@ export class ImageLabelBox extends ViewBoxBaseComponent() { const url = ImageCastWithSuffix(doc[Doc.LayoutDataKey(doc)], '_o') ?? ''; return imageUrlToBase64(url).then(hrefBase64 => !hrefBase64 ? undefined : - gptImageLabel(hrefBase64, prompt ?? 'Give three labels to describe this image.').then(labels => + gptImageLabel(hrefBase64, 'Give three labels to describe this image.').then(labels => ({ doc, labels }))) ; // prettier-ignore } }); -- cgit v1.2.3-70-g09d2