NovelAI preamble code cleanup

This commit is contained in:
Mike Weldon
2023-08-03 18:22:46 -07:00
parent ea809023b5
commit 079b1623c5
3 changed files with 20 additions and 16 deletions

View File

@@ -2669,8 +2669,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
setPromtString();
}
// add chat preamble
mesSendString = addChatsPreamble(mesSendString);
// add a custom dingus (if defined)
mesSendString = adjustChatsSeparator(mesSendString);
mesSendString = addChatsSeparator(mesSendString);
let finalPromt =
storyString +
@@ -3156,16 +3159,13 @@ function parseTokenCounts(counts, thisPromptBits) {
});
}
function adjustChatsSeparator(mesSendString) {
if (main_api === 'novel') {
let preamble = "\n***\n" + nai_settings.nai_preamble;
if (!preamble.endsWith('\n')) {
preamble += '\n';
}
mesSendString = preamble + mesSendString;
}
function addChatsPreamble(mesSendString) {
const preamble = main_api === 'novel' ? nai_settings.preamble : "";
return preamble + '\n' + mesSendString;
}
else if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) {
function addChatsSeparator(mesSendString) {
if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) {
mesSendString = power_user.custom_chat_separator + '\n' + mesSendString;
}
@@ -3174,6 +3174,10 @@ function adjustChatsSeparator(mesSendString) {
mesSendString = mesSendString;
}
else if (main_api === 'novel') {
mesSendString = '\n***\n' + mesSendString;
}
// add non-pygma dingus
else if (!is_pygmalion) {
mesSendString = '\nThen the roleplay chat between ' + name1 + ' and ' + name2 + ' begins.\n' + mesSendString;