From fdac8b4e76e46fcab78e4d64be8d75c20a30ba2f Mon Sep 17 00:00:00 2001 From: S-Del Date: Tue, 22 Aug 2023 15:54:29 +0900 Subject: [PATCH] Special keywords are not excluded as duplicates Special keywords like AND and BREAK might be written multiple times within the prompt, so I've made changes to ensure they are not excluded even if they appear duplicated. --- javascript/prompt_format.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/javascript/prompt_format.js b/javascript/prompt_format.js index c193073..fb8dd13 100644 --- a/javascript/prompt_format.js +++ b/javascript/prompt_format.js @@ -53,10 +53,15 @@ if (!cleanArray.includes(cleanedTag)) { cleanArray.push(cleanedTag) finalArray.push(tag) - } else { - finalArray.push(tag.replace(cleanedTag, '')) + return } + if (/^(AND|BREAK)$/.test(cleanedTag)) { + finalArray.push(tag) + return + } + + finalArray.push(tag.replace(cleanedTag, '')) }) input = finalArray.join(', ')