Many NovelAI fixes from dev guidance

* Remove AI Module "Autoselect" and make the auto-instruct work for all modules. This is how NAI is supposed to work.
* Log the response from the API.
* Move the AI Module setting up to the top of the settings window since it isn't part of the preset.
* Refactor phrase_rep_pen to use the actual API strings.
* Clamp the maximum token length to 150 before we call the API.
* Clamp the minimum token length in the UX from 1 to 150.
* Fix bug where the preamble was not initialized on cold start.
* Get rid of extra newline before dinkus.
* Make always_force_name2 default true.
This commit is contained in:
Mike Weldon
2023-08-14 18:40:43 -07:00
parent 9f49a2612c
commit 41ec7e5600
5 changed files with 49 additions and 69 deletions

View File

@ -3334,8 +3334,9 @@ function parseTokenCounts(counts, thisPromptBits) {
}
function addChatsPreamble(mesSendString) {
const preamble = main_api === 'novel' ? nai_settings.preamble : "";
return preamble + '\n' + mesSendString;
return main_api === 'novel'
? nai_settings.preamble + '\n' + mesSendString
: mesSendString;
}
function addChatsSeparator(mesSendString) {
@ -3349,7 +3350,7 @@ function addChatsSeparator(mesSendString) {
}
else if (main_api === 'novel') {
mesSendString = '\n***\n' + mesSendString;
mesSendString = '***\n' + mesSendString;
}
// add non-pygma dingus
@ -4609,6 +4610,12 @@ function changeMainAPI() {
activeItem.amountGenElem.css("opacity", 1.0);
}
if (selectedVal === "novel") {
$("#ai_module_block_novel").css("display", "block");
} else {
$("#ai_module_block_novel").css("display", "none");
}
// Hide common settings for OpenAI
console.debug('value?', selectedVal);
if (selectedVal == "openai") {