From 4a35059711d3c0d0dffb8595e78780cf6b1331fa Mon Sep 17 00:00:00 2001 From: caranicas Date: Wed, 14 Sep 2022 13:07:27 -0400 Subject: [PATCH] comments --- .../creationPanel/makeButton/index.tsx | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ui/frontend/build_src/src/components/creationPanel/makeButton/index.tsx b/ui/frontend/build_src/src/components/creationPanel/makeButton/index.tsx index fb0b2dc0..6a74433b 100644 --- a/ui/frontend/build_src/src/components/creationPanel/makeButton/index.tsx +++ b/ui/frontend/build_src/src/components/creationPanel/makeButton/index.tsx @@ -13,41 +13,52 @@ export default function MakeButton() { const addNewImage = useImageQueue((state) => state.addNewImage); const makeImages = () => { + + // the request that we have built const req = builtRequest(); + // the actual number of request we will make let requests = []; + // the number of images we will make let { num_outputs } = req; + // if making fewer images than the parallel count + // then it is only 1 request if( parallelCount > num_outputs ) { requests.push(num_outputs); } else { + // while we have at least 1 image to make while (num_outputs >= 1) { + // subtract the parallel count from the number of images to make num_outputs -= parallelCount; + + // if we are still 0 or greater we can make the full parallel count if(num_outputs <= 0) { requests.push(parallelCount) } + // otherwise we can only make the remaining images else { requests.push(Math.abs(num_outputs)) } } } - console.log('requests', requests); - + // make the requests requests.forEach((num, index) => { - console.log('num', num); + // get the seed we want to use let seed = req.seed; if(index !== 0) { + // we want to use a random seed for subsequent requests seed = useRandomSeed(); } - - // debugger; - + // add the request to the queue addNewImage(uuidv4(), { ...req, + // updated the number of images to make num_outputs: num, + // update the seed seed: seed }) });