mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #856 from mweldon/preamble
This commit is contained in:
19
public/NovelAI Settings/Pro_Writer-Kayra.settings
Normal file
19
public/NovelAI Settings/Pro_Writer-Kayra.settings
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"order": [3, 4, 0],
|
||||||
|
"temperature": 1.19,
|
||||||
|
"max_length": 300,
|
||||||
|
"min_length": 1,
|
||||||
|
"top_a": 0.116,
|
||||||
|
"tail_free_sampling": 0.958,
|
||||||
|
"repetition_penalty": 1.64,
|
||||||
|
"repetition_penalty_slope": 2.12,
|
||||||
|
"repetition_penalty_frequency": 0,
|
||||||
|
"repetition_penalty_presence": 0,
|
||||||
|
"repetition_penalty_range": 2048,
|
||||||
|
"use_cache": false,
|
||||||
|
"return_full_text": false,
|
||||||
|
"prefix": "vanilla",
|
||||||
|
"phrase_rep_pen": "medium",
|
||||||
|
"cfg_scale": 1.0,
|
||||||
|
"max_context": 7800
|
||||||
|
}
|
19
public/NovelAI Settings/Tea_Time-Kayra.settings
Normal file
19
public/NovelAI Settings/Tea_Time-Kayra.settings
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"order": [5, 0, 4],
|
||||||
|
"temperature": 1,
|
||||||
|
"max_length": 300,
|
||||||
|
"min_length": 1,
|
||||||
|
"top_a": 0.017,
|
||||||
|
"typical_p": 0.975,
|
||||||
|
"repetition_penalty": 3,
|
||||||
|
"repetition_penalty_slope": 0.09,
|
||||||
|
"repetition_penalty_frequency": 0,
|
||||||
|
"repetition_penalty_presence": 0,
|
||||||
|
"repetition_penalty_range": 7680,
|
||||||
|
"use_cache": false,
|
||||||
|
"return_full_text": false,
|
||||||
|
"prefix": "vanilla",
|
||||||
|
"phrase_rep_pen": "aggressive",
|
||||||
|
"cfg_scale": 1.0,
|
||||||
|
"max_context": 7800
|
||||||
|
}
|
@ -807,6 +807,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="novel_api-settings">
|
<div id="novel_api-settings">
|
||||||
|
<div class="range-block">
|
||||||
|
<div class="range-block-title openai_restorable">
|
||||||
|
<span data-i18n="Preamble">Preamble</span>
|
||||||
|
<div id="nai_preamble_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt"
|
||||||
|
class="right_menu_button">
|
||||||
|
<div class="fa-solid fa-clock-rotate-left "></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-description justifyLeft" data-i18n="Use style tags to improve the quality of the output">
|
||||||
|
Use style tags to improve the quality of the output
|
||||||
|
</div>
|
||||||
|
<div class="wide100p">
|
||||||
|
<textarea id="nai_preamble_textarea" class="text_pole textarea_compact" name="nai_preamble" rows="2"
|
||||||
|
placeholder=""></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="range-block">
|
<div class="range-block">
|
||||||
<div class="range-block-title" data-i18n="Top P">
|
<div class="range-block-title" data-i18n="Top P">
|
||||||
Top P
|
Top P
|
||||||
|
@ -3142,7 +3142,15 @@ function parseTokenCounts(counts, thisPromptBits) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function adjustChatsSeparator(mesSendString) {
|
function adjustChatsSeparator(mesSendString) {
|
||||||
if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) {
|
if (main_api === 'novel') {
|
||||||
|
let preamble = "\n***\n" + nai_settings.nai_preamble;
|
||||||
|
if (!preamble.endsWith('\n')) {
|
||||||
|
preamble += '\n';
|
||||||
|
}
|
||||||
|
mesSendString = preamble + mesSendString;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) {
|
||||||
mesSendString = power_user.custom_chat_separator + '\n' + mesSendString;
|
mesSendString = power_user.custom_chat_separator + '\n' + mesSendString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ export {
|
|||||||
getNovelTier,
|
getNovelTier,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const default_preamble = "[ Style: chat, complex, sensory, visceral ]";
|
||||||
|
|
||||||
const nai_settings = {
|
const nai_settings = {
|
||||||
temperature: 0.5,
|
temperature: 0.5,
|
||||||
repetition_penalty: 1,
|
repetition_penalty: 1,
|
||||||
@ -29,6 +31,7 @@ const nai_settings = {
|
|||||||
model_novel: "euterpe-v2",
|
model_novel: "euterpe-v2",
|
||||||
preset_settings_novel: "Classic-Euterpe",
|
preset_settings_novel: "Classic-Euterpe",
|
||||||
streaming_novel: false,
|
streaming_novel: false,
|
||||||
|
nai_preamble: default_preamble,
|
||||||
};
|
};
|
||||||
|
|
||||||
const nai_tiers = {
|
const nai_tiers = {
|
||||||
@ -76,6 +79,7 @@ function loadNovelSettings(settings) {
|
|||||||
$(`#model_novel_select option[value=${nai_settings.model_novel}]`).attr("selected", true);
|
$(`#model_novel_select option[value=${nai_settings.model_novel}]`).attr("selected", true);
|
||||||
$('#model_novel_select').val(nai_settings.model_novel);
|
$('#model_novel_select').val(nai_settings.model_novel);
|
||||||
|
|
||||||
|
if (settings.nai_preamble !== undefined) nai_settings.nai_preamble = settings.nai_preamble;
|
||||||
nai_settings.preset_settings_novel = settings.preset_settings_novel;
|
nai_settings.preset_settings_novel = settings.preset_settings_novel;
|
||||||
nai_settings.temperature = settings.temperature;
|
nai_settings.temperature = settings.temperature;
|
||||||
nai_settings.repetition_penalty = settings.repetition_penalty;
|
nai_settings.repetition_penalty = settings.repetition_penalty;
|
||||||
@ -157,6 +161,7 @@ function loadNovelSettingsUi(ui_settings) {
|
|||||||
$("#phrase_rep_pen_counter_novel").text(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
|
$("#phrase_rep_pen_counter_novel").text(getPhraseRepPenCounter(ui_settings.phrase_rep_pen));
|
||||||
$("#min_length_novel").val(ui_settings.min_length);
|
$("#min_length_novel").val(ui_settings.min_length);
|
||||||
$("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
|
$("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
|
||||||
|
$('#nai_preamble_textarea').val(ui_settings.nai_preamble);
|
||||||
|
|
||||||
$("#streaming_novel").prop('checked', ui_settings.streaming_novel);
|
$("#streaming_novel").prop('checked', ui_settings.streaming_novel);
|
||||||
}
|
}
|
||||||
@ -259,6 +264,13 @@ export function getNovelGenerationData(finalPromt, this_settings, this_amount_ge
|
|||||||
.map(t => getTextTokens(tokenizerType, t))
|
.map(t => getTextTokens(tokenizerType, t))
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
let useInstruct = false;
|
||||||
|
if (isNewModel) {
|
||||||
|
// NovelAI claims they scan backwards 1000 characters (not tokens!) to look for instruct brackets. That's really short.
|
||||||
|
const tail = finalPromt.slice(-1500);
|
||||||
|
useInstruct = tail.includes("}");
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"input": finalPromt,
|
"input": finalPromt,
|
||||||
"model": nai_settings.model_novel,
|
"model": nai_settings.model_novel,
|
||||||
@ -286,7 +298,7 @@ export function getNovelGenerationData(finalPromt, this_settings, this_amount_ge
|
|||||||
"use_cache": false,
|
"use_cache": false,
|
||||||
"use_string": true,
|
"use_string": true,
|
||||||
"return_full_text": false,
|
"return_full_text": false,
|
||||||
"prefix": isNewModel ? "special_instruct" : "vanilla",
|
"prefix": useInstruct ? "special_instruct" : (isNewModel ? "special_proseaugmenter" : "vanilla"),
|
||||||
"order": this_settings.order,
|
"order": this_settings.order,
|
||||||
"streaming": nai_settings.streaming_novel,
|
"streaming": nai_settings.streaming_novel,
|
||||||
};
|
};
|
||||||
@ -334,6 +346,17 @@ export async function generateNovelWithStreaming(generate_data, signal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#nai_preamble_textarea").on('input', function () {
|
||||||
|
nai_settings.nai_preamble = $('#nai_preamble_textarea').val();
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#nai_preamble_restore").on('click', function () {
|
||||||
|
nai_settings.nai_preamble = default_preamble;
|
||||||
|
$('#nai_preamble_textarea').val(nai_settings.nai_preamble);
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
sliders.forEach(slider => {
|
sliders.forEach(slider => {
|
||||||
$(document).on("input", slider.sliderId, function () {
|
$(document).on("input", slider.sliderId, function () {
|
||||||
|
Reference in New Issue
Block a user