From 3a7281df3c554ab93917a4077630623c45dea685 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 26 Jun 2023 20:36:59 +0530 Subject: [PATCH] Fix for prompt number calculation with empty or single-element set --- ui/media/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index fda0493c..20299b10 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -1347,7 +1347,7 @@ function getPromptsNumber(prompts) { // 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) + 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) {