From 6e1e36c1dd4476ec0d8905198b2c3fd8eae26ae8 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Fri, 20 Dec 2024 17:12:36 -0300 Subject: [PATCH] if image was loaded then consider regenerate --- .../components/ai-image/featured-image.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx index 60ce8005deb0c..f1b781688b577 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/featured-image.tsx @@ -201,7 +201,7 @@ export default function FeaturedImage( { style: style, } ); - setCurrent( crrt => crrt + 1 ); + setCurrent( () => images.length ); processImageGeneration( { userPrompt, postContent: postTitle + '\n\n' + postContent, @@ -228,6 +228,7 @@ export default function FeaturedImage( { postTitle, postContent, notEnoughRequests, + images, ] ); @@ -398,7 +399,9 @@ export default function FeaturedImage( { placement={ placement } onClose={ handleModalClose } onTryAgain={ handleTryAgain } - onGenerate={ pointer?.current > 0 ? handleRegenerate : handleGenerate } + onGenerate={ + pointer?.current > 0 || postFeaturedMediaId ? handleRegenerate : handleGenerate + } generating={ currentPointer?.generating } notEnoughRequests={ notEnoughRequests } requireUpgrade={ requireUpgrade }