Incorporated proposal by @JeLuF in #1324

This commit is contained in:
ManInDark 2023-06-13 16:09:54 +02:00
parent 5e07432ae9
commit 6ae4314b79
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779

View File

@ -1342,6 +1342,16 @@ function getPromptsNumber(prompts) {
prompts = prompts.map((prompt) => prompt.trim())
prompts = prompts.filter((prompt) => prompt !== "")
// estimate number of prompts
let estimatedNumberOfPrompts = 0
prompts.forEach((prompt) => {
estimatedNumberOfPrompts += (prompt.match(/{[^}]*}/g) || []).map((e) => e.match(/,/g).length + 1).reduce( (p,a) => p*a, 1) * (2**(prompt.match(/\|/g) || []).length)
})
if (estimatedNumberOfPrompts >= 10000) {
return 10000
}
promptsToMake = applySetOperator(prompts) // switched those around as Set grows in a linear fashion and permute in 2^n, and one has to be computed for the other to be calculated
numberOfPrompts = applyPermuteOperatorNumber(promptsToMake)
}
@ -1613,8 +1623,14 @@ function renameMakeImageButton() {
imageLabel = totalImages + " Images"
}
if (SD.activeTasks.size == 0) {
if (totalImages >= 10000)
makeImageBtn.innerText = "Make tens of thousands of images"
else
makeImageBtn.innerText = "Make " + imageLabel
} else {
if (totalImages >= 10000)
makeImageBtn.innerText = "Enqueue tens of thousands of images"
else
makeImageBtn.innerText = "Enqueue Next " + imageLabel
}
}