Add copy to clipboard button on prompt itemization popup (#1124)

* Add copy to clipboard button on prompt itemization popup

* Minor fix for NovelAI Summarize and new bad words
This commit is contained in:
mweldon 2023-09-13 01:52:37 -07:00 committed by GitHub
parent 09fc42a787
commit e74090139c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 4 deletions

View File

@ -161,6 +161,7 @@
}
#showRawPrompt,
#copyPromptToClipboard,
#groupCurrentMemberPopoutButton {
display: none;
}

View File

@ -2754,7 +2754,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
// Add quiet generation prompt at depth 0
if (quiet_prompt && quiet_prompt.length) {
const name = name1;
const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, '', name1, name2, false) : `\n${name}: ${quiet_prompt}`;
const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, '', name1, name2, false) : `\n${quiet_prompt}`;
lastMesString += quietAppend;
// Bail out early
return lastMesString;
@ -8018,6 +8018,18 @@ jQuery(async function () {
}
})
$(document).on("pointerup", "#copyPromptToClipboard", function () {
let rawPrompt = itemizedPrompts[PromptArrayItemForRawPromptDisplay].rawPrompt;
let rawPromptValues = rawPrompt;
if (Array.isArray(rawPrompt)) {
rawPromptValues = rawPrompt.map(x => x.content).join('\n');
}
navigator.clipboard.writeText(rawPromptValues);
toastr.info('Copied!', '', { timeOut: 2000 });
});
$(document).on("pointerup", "#showRawPrompt", function () {
//console.log(itemizedPrompts[PromptArrayItemForRawPromptDisplay].rawPrompt);
console.log(PromptArrayItemForRawPromptDisplay);

View File

@ -1,6 +1,7 @@
<h3 class="flex-container justifyCenter alignitemscenter">
Prompt Itemization
<div id="showRawPrompt" class="fa-solid fa-square-poll-horizontal menu_button"></div>
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button"></div>
</h3>
Tokenizer: {{selectedTokenizer}}<br>
API Used: {{this_main_api}}<br>

View File

@ -1,6 +1,7 @@
<h3 class="flex-container justifyCenter alignitemscenter">
Prompt Itemization
<div id="showRawPrompt" class="fa-solid fa-square-poll-horizontal menu_button"></div>
<div id="copyPromptToClipboard" class="fa-solid fa-copy menu_button"></div>
</h3>
Tokenizer: {{selectedTokenizer}}<br>
API Used: {{this_main_api}}<br>

View File

@ -1,8 +1,7 @@
// Ban bracket generation, plus defaults
const badWordsList = [
[23], [49209, 23], [23], [49209, 23], [23], [49209, 23], [23], [49209, 23], [23], [49209, 23], [21], [49209, 21],
[21], [49209, 21], [21], [49209, 21], [21], [49209, 21], [21], [49209, 21], [3], [49356], [1431], [31715], [34387],
[20765], [30702], [10691], [49333], [1266], [26523], [41471], [2936], [85, 85], [49332], [7286], [1115], [19438, 2542],
[3], [49356], [1431], [31715], [34387], [20765], [30702], [10691], [49333], [1266],
[19438], [43145], [26523], [41471], [2936], [85, 85], [49332], [7286], [1115]
]
const hypeBotBadWordsList = [