diff --git a/public/script.js b/public/script.js
index 6c80d28db..c68c9e535 100644
--- a/public/script.js
+++ b/public/script.js
@@ -4918,11 +4918,6 @@ async function getSettings(type) {
novelai_setting_names = {};
novelai_setting_names = arr_holder;
- nai_settings.preset_settings_novel = settings.preset_settings_novel;
- $(
- `#settings_perset_novel option[value=${novelai_setting_names[nai_settings.preset_settings_novel]}]`
- ).attr("selected", "true");
-
//Load AI model config settings
amount_gen = settings.amount_gen;
@@ -4935,10 +4930,11 @@ async function getSettings(type) {
showSwipeButtons();
// Kobold
- loadKoboldSettings(settings);
+ loadKoboldSettings(settings.kai_settings ?? settings);
// Novel
- loadNovelSettings(settings);
+ loadNovelSettings(settings.nai_settings ?? settings);
+ $(`#settings_perset_novel option[value=${novelai_setting_names[nai_settings.preset_settings_novel]}]`).attr("selected", "true");
// TextGen
loadTextGenSettings(data, settings);
@@ -5058,8 +5054,8 @@ async function saveSettings(type) {
context_settings: context_settings,
tags: tags,
tag_map: tag_map,
- ...nai_settings,
- ...kai_settings,
+ nai_settings: nai_settings,
+ kai_settings: kai_settings,
...oai_settings,
}, null, 4),
beforeSend: function () {
diff --git a/public/scripts/nai-settings.js b/public/scripts/nai-settings.js
index 9cef66ab7..72b47d47d 100644
--- a/public/scripts/nai-settings.js
+++ b/public/scripts/nai-settings.js
@@ -11,13 +11,18 @@ export {
};
const nai_settings = {
- temp_novel: 0.5,
- rep_pen_novel: 1,
- rep_pen_size_novel: 100,
- rep_pen_slope_novel: 0,
- rep_pen_freq_novel: 0,
- rep_pen_presence_novel: 0,
- tail_free_sampling_novel: 0.68,
+ temperature: 0.5,
+ repetition_penalty: 1,
+ repetition_penalty_range: 100,
+ repetition_penalty_slope: 0,
+ repetition_penalty_frequency: 0,
+ repetition_penalty_presence: 0,
+ tail_free_sampling: 0.68,
+ top_k: 0,
+ top_p: 1,
+ top_a: 1,
+ typical_p: 1,
+ min_length: 0,
model_novel: "euterpe-v2",
preset_settings_novel: "Classic-Euterpe",
streaming_novel: false,
@@ -45,13 +50,18 @@ function loadNovelPreset(preset) {
$("#max_context_counter").text(`${preset.max_context}`);
$("#rep_pen_size_novel").attr('max', preset.max_context);
- nai_settings.temp_novel = preset.temperature;
- nai_settings.rep_pen_novel = preset.repetition_penalty;
- nai_settings.rep_pen_size_novel = preset.repetition_penalty_range;
- nai_settings.rep_pen_slope_novel = preset.repetition_penalty_slope;
- nai_settings.rep_pen_freq_novel = preset.repetition_penalty_frequency;
- nai_settings.rep_pen_presence_novel = preset.repetition_penalty_presence;
- nai_settings.tail_free_sampling_novel = preset.tail_free_sampling;
+ nai_settings.temperature = preset.temperature;
+ nai_settings.repetition_penalty = preset.repetition_penalty;
+ nai_settings.repetition_penalty_range = preset.repetition_penalty_range;
+ nai_settings.repetition_penalty_slope = preset.repetition_penalty_slope;
+ nai_settings.repetition_penalty_frequency = preset.repetition_penalty_frequency;
+ nai_settings.repetition_penalty_presence = preset.repetition_penalty_presence;
+ nai_settings.tail_free_sampling = preset.tail_free_sampling;
+ nai_settings.top_k = preset.top_k;
+ nai_settings.top_p = preset.top_p;
+ nai_settings.top_a = preset.top_a;
+ nai_settings.typical_p = preset.typical_p;
+ nai_settings.min_length = preset.min_length;
loadNovelSettingsUi(nai_settings);
}
@@ -59,33 +69,58 @@ function loadNovelSettings(settings) {
//load the rest of the Novel settings without any checks
nai_settings.model_novel = settings.model_novel;
$(`#model_novel_select option[value=${nai_settings.model_novel}]`).attr("selected", true);
+ $('#model_novel_select').val(nai_settings.model_novel);
- nai_settings.temp_novel = settings.temp_novel;
- nai_settings.rep_pen_novel = settings.rep_pen_novel;
- nai_settings.rep_pen_size_novel = settings.rep_pen_size_novel;
- nai_settings.rep_pen_slope_novel = settings.rep_pen_slope_novel;
- nai_settings.rep_pen_freq_novel = settings.rep_pen_freq_novel;
- nai_settings.rep_pen_presence_novel = settings.rep_pen_presence_novel;
- nai_settings.tail_free_sampling_novel = settings.tail_free_sampling_novel;
+ nai_settings.preset_settings_novel = settings.preset_settings_novel;
+ nai_settings.temperature = settings.temperature;
+ nai_settings.repetition_penalty = settings.repetition_penalty;
+ nai_settings.repetition_penalty_range = settings.repetition_penalty_range;
+ nai_settings.repetition_penalty_slope = settings.repetition_penalty_slope;
+ nai_settings.repetition_penalty_frequency = settings.repetition_penalty_frequency;
+ nai_settings.repetition_penalty_presence = settings.repetition_penalty_presence;
+ nai_settings.tail_free_sampling = settings.tail_free_sampling;
+ nai_settings.top_k = settings.top_k;
+ nai_settings.top_p = settings.top_p;
+ nai_settings.top_a = settings.top_a;
+ nai_settings.typical_p = settings.typical_p;
+ nai_settings.min_length = settings.min_length;
nai_settings.streaming_novel = !!settings.streaming_novel;
loadNovelSettingsUi(nai_settings);
+
+ // reload the preset to migrate any new settings
+ for (const key of Object.keys(nai_settings)) {
+ if (typeof nai_settings[key] === 'number' && Number.isNaN(nai_settings[key])) {
+ $("#settings_perset_novel").trigger("change");
+ }
+ }
}
function loadNovelSettingsUi(ui_settings) {
- $("#temp_novel").val(ui_settings.temp_novel);
- $("#temp_counter_novel").text(Number(ui_settings.temp_novel).toFixed(2));
- $("#rep_pen_novel").val(ui_settings.rep_pen_novel);
- $("#rep_pen_counter_novel").text(Number(ui_settings.rep_pen_novel).toFixed(2));
- $("#rep_pen_size_novel").val(ui_settings.rep_pen_size_novel);
- $("#rep_pen_size_counter_novel").text(Number(ui_settings.rep_pen_size_novel).toFixed(0));
- $("#rep_pen_slope_novel").val(ui_settings.rep_pen_slope_novel);
- $("#rep_pen_slope_counter_novel").text(Number(`${ui_settings.rep_pen_slope_novel}`).toFixed(2));
- $("#rep_pen_freq_novel").val(ui_settings.rep_pen_freq_novel);
- $("#rep_pen_freq_counter_novel").text(Number(ui_settings.rep_pen_freq_novel).toFixed(5));
- $("#rep_pen_presence_novel").val(ui_settings.rep_pen_presence_novel);
- $("#rep_pen_presence_counter_novel").text(Number(ui_settings.rep_pen_presence_novel).toFixed(3));
- $("#tail_free_sampling_novel").val(ui_settings.tail_free_sampling_novel);
- $("#tail_free_sampling_counter_novel").text(Number(ui_settings.tail_free_sampling_novel).toFixed(3));
+ $("#temp_novel").val(ui_settings.temperature);
+ $("#temp_counter_novel").text(Number(ui_settings.temperature).toFixed(2));
+ $("#rep_pen_novel").val(ui_settings.repetition_penalty);
+ $("#rep_pen_counter_novel").text(Number(ui_settings.repetition_penalty).toFixed(2));
+ $("#rep_pen_size_novel").val(ui_settings.repetition_penalty_range);
+ $("#rep_pen_size_counter_novel").text(Number(ui_settings.repetition_penalty_range).toFixed(0));
+ $("#rep_pen_slope_novel").val(ui_settings.repetition_penalty_slope);
+ $("#rep_pen_slope_counter_novel").text(Number(`${ui_settings.repetition_penalty_slope}`).toFixed(2));
+ $("#rep_pen_freq_novel").val(ui_settings.repetition_penalty_frequency);
+ $("#rep_pen_freq_counter_novel").text(Number(ui_settings.repetition_penalty_frequency).toFixed(5));
+ $("#rep_pen_presence_novel").val(ui_settings.repetition_penalty_presence);
+ $("#rep_pen_presence_counter_novel").text(Number(ui_settings.repetition_penalty_presence).toFixed(3));
+ $("#tail_free_sampling_novel").val(ui_settings.tail_free_sampling);
+ $("#tail_free_sampling_counter_novel").text(Number(ui_settings.tail_free_sampling).toFixed(3));
+ $("#top_k_novel").val(ui_settings.top_k);
+ $("#top_k_counter_novel").text(Number(ui_settings.top_k).toFixed(0));
+ $("#top_p_novel").val(ui_settings.top_p);
+ $("#top_p_counter_novel").text(Number(ui_settings.top_p).toFixed(2));
+ $("#top_a_novel").val(ui_settings.top_a);
+ $("#top_a_counter_novel").text(Number(ui_settings.top_a).toFixed(2));
+ $("#typical_p_novel").val(ui_settings.typical_p);
+ $("#typical_p_counter_novel").text(Number(ui_settings.typical_p).toFixed(2));
+ $("#min_length_novel").val(ui_settings.min_length);
+ $("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
+
$("#streaming_novel").prop('checked', ui_settings.streaming_novel);
}
@@ -94,43 +129,73 @@ const sliders = [
sliderId: "#temp_novel",
counterId: "#temp_counter_novel",
format: (val) => Number(val).toFixed(2),
- setValue: (val) => { nai_settings.temp_novel = Number(val).toFixed(2); },
+ setValue: (val) => { nai_settings.temperature = Number(val).toFixed(2); },
},
{
sliderId: "#rep_pen_novel",
counterId: "#rep_pen_counter_novel",
format: (val) => Number(val).toFixed(2),
- setValue: (val) => { nai_settings.rep_pen_novel = Number(val).toFixed(2); },
+ setValue: (val) => { nai_settings.repetition_penalty = Number(val).toFixed(2); },
},
{
sliderId: "#rep_pen_size_novel",
counterId: "#rep_pen_size_counter_novel",
format: (val) => `${val}`,
- setValue: (val) => { nai_settings.rep_pen_size_novel = Number(val).toFixed(0); },
+ setValue: (val) => { nai_settings.repetition_penalty_range = Number(val).toFixed(0); },
},
{
sliderId: "#rep_pen_slope_novel",
counterId: "#rep_pen_slope_counter_novel",
format: (val) => `${val}`,
- setValue: (val) => { nai_settings.rep_pen_slope_novel = Number(val).toFixed(2); },
+ setValue: (val) => { nai_settings.repetition_penalty_slope = Number(val).toFixed(2); },
},
{
sliderId: "#rep_pen_freq_novel",
counterId: "#rep_pen_freq_counter_novel",
format: (val) => `${val}`,
- setValue: (val) => { nai_settings.rep_pen_freq_novel = Number(val).toFixed(5); },
+ setValue: (val) => { nai_settings.repetition_penalty_frequency = Number(val).toFixed(5); },
},
{
sliderId: "#rep_pen_presence_novel",
counterId: "#rep_pen_presence_counter_novel",
format: (val) => `${val}`,
- setValue: (val) => { nai_settings.rep_pen_presence_novel = Number(val).toFixed(3); },
+ setValue: (val) => { nai_settings.repetition_penalty_presence = Number(val).toFixed(3); },
},
{
sliderId: "#tail_free_sampling_novel",
counterId: "#tail_free_sampling_counter_novel",
format: (val) => `${val}`,
- setValue: (val) => { nai_settings.tail_free_sampling_novel = Number(val).toFixed(3); },
+ setValue: (val) => { nai_settings.tail_free_sampling = Number(val).toFixed(3); },
+ },
+ {
+ sliderId: "#top_k_novel",
+ counterId: "#top_k_counter_novel",
+ format: (val) => `${val}`,
+ setValue: (val) => { nai_settings.top_k = Number(val).toFixed(0); },
+ },
+ {
+ sliderId: "#top_p_novel",
+ counterId: "#top_p_counter_novel",
+ format: (val) => Number(val).toFixed(2),
+ setValue: (val) => { nai_settings.top_p = Number(val).toFixed(2); },
+ },
+ {
+ sliderId: "#top_a_novel",
+ counterId: "#top_a_counter_novel",
+ format: (val) => Number(val).toFixed(2),
+ setValue: (val) => { nai_settings.top_a = Number(val).toFixed(2); },
+ },
+ {
+ sliderId: "#typical_p_novel",
+ counterId: "#typical_p_counter_novel",
+ format: (val) => Number(val).toFixed(2),
+ setValue: (val) => { nai_settings.typical_p = Number(val).toFixed(2); },
+ },
+ {
+ sliderId: "#min_length_novel",
+ counterId: "#min_length_counter_novel",
+ format: (val) => `${val}`,
+ setValue: (val) => { nai_settings.min_length = Number(val).toFixed(0); },
},
];
@@ -139,19 +204,19 @@ export function getNovelGenerationData(finalPromt, this_settings, this_amount_ge
"input": finalPromt,
"model": nai_settings.model_novel,
"use_string": true,
- "temperature": parseFloat(nai_settings.temp_novel),
+ "temperature": parseFloat(nai_settings.temperature),
"max_length": this_amount_gen, // this_settings.max_length, // <= why?
- "min_length": this_settings.min_length,
- "tail_free_sampling": parseFloat(nai_settings.tail_free_sampling_novel),
- "repetition_penalty": parseFloat(nai_settings.rep_pen_novel),
- "repetition_penalty_range": parseInt(nai_settings.rep_pen_size_novel),
- "repetition_penalty_slope": parseFloat(nai_settings.rep_pen_slope_novel),
- "repetition_penalty_frequency": parseFloat(nai_settings.rep_pen_freq_novel),
- "repetition_penalty_presence": parseFloat(nai_settings.rep_pen_presence_novel),
- "top_a": this_settings.top_a,
- "top_p": this_settings.top_p,
- "top_k": this_settings.top_k,
- "typical_p": this_settings.typical_p,
+ "min_length": parseInt(nai_settings.min_length),
+ "tail_free_sampling": parseFloat(nai_settings.tail_free_sampling),
+ "repetition_penalty": parseFloat(nai_settings.repetition_penalty),
+ "repetition_penalty_range": parseInt(nai_settings.repetition_penalty_range),
+ "repetition_penalty_slope": parseFloat(nai_settings.repetition_penalty_slope),
+ "repetition_penalty_frequency": parseFloat(nai_settings.repetition_penalty_frequency),
+ "repetition_penalty_presence": parseFloat(nai_settings.repetition_penalty_presence),
+ "top_a": parseFloat(nai_settings.top_a),
+ "top_p": parseFloat(nai_settings.top_p),
+ "top_k": parseInt(nai_settings.top_k),
+ "typical_p": parseFloat(nai_settings.typical_p),
//"stop_sequences": {{187}},
//bad_words_ids = {{50256}, {0}, {1}};
"generate_until_sentence": true,
@@ -212,7 +277,7 @@ $(document).ready(function () {
const value = $(this).val();
const formattedValue = slider.format(value);
slider.setValue(value);
- $(slider.counterId).html(formattedValue);
+ $(slider.counterId).text(formattedValue);
console.log('saving');
saveSettingsDebounced();
});
diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js
index 040cb2538..c69e5f715 100644
--- a/public/scripts/textgen-settings.js
+++ b/public/scripts/textgen-settings.js
@@ -11,7 +11,7 @@ export {
generateTextGenWithStreaming,
}
-let textgenerationwebui_settings = {
+const textgenerationwebui_settings = {
temp: 0.7,
top_p: 0.5,
top_k: 40,