Save chat completions settings to an object. Update numeric setting types

This commit is contained in:
Cohee 2023-08-22 00:35:46 +03:00
parent 75db476f76
commit 57b126bfbf
3 changed files with 183 additions and 181 deletions

View File

@ -418,8 +418,9 @@
5
]
},
"oai_settings": {
"preset_settings_openai": "Default",
"temp_openai": "0.9",
"temp_openai": 0.9,
"freq_pen_openai": 0.7,
"pres_pen_openai": 0.7,
"count_pen": 0,
@ -600,4 +601,5 @@
"use_ai21_tokenizer": false,
"exclude_assistant": false,
"nsfw_avoidance_prompt": "Avoid writing a NSFW/Smut reply. Creatively write around it NSFW/Smut scenarios in character."
}
}

View File

@ -5333,7 +5333,7 @@ async function getSettings(type) {
loadTextGenSettings(data, settings);
// OpenAI
loadOpenAISettings(data, settings);
loadOpenAISettings(data, settings.oai_settings ?? settings);
// Horde
loadHordeSettings(settings);
@ -5448,7 +5448,7 @@ async function saveSettings(type) {
tag_map: tag_map,
nai_settings: nai_settings,
kai_settings: kai_settings,
...oai_settings,
oai_settings: oai_settings,
}, null, 4),
beforeSend: function () {
if (type == "change_name") {

View File

@ -2964,37 +2964,37 @@ $(document).ready(async function () {
$('#test_api_button').on('click', testApiConnection);
$(document).on('input', '#temp_openai', function () {
oai_settings.temp_openai = $(this).val();
oai_settings.temp_openai = Number($(this).val());
$('#temp_counter_openai').text(Number($(this).val()).toFixed(2));
saveSettingsDebounced();
});
$(document).on('input', '#freq_pen_openai', function () {
oai_settings.freq_pen_openai = $(this).val();
oai_settings.freq_pen_openai = Number($(this).val());
$('#freq_pen_counter_openai').text(Number($(this).val()).toFixed(2));
saveSettingsDebounced();
});
$(document).on('input', '#pres_pen_openai', function () {
oai_settings.pres_pen_openai = $(this).val();
oai_settings.pres_pen_openai = Number($(this).val());
$('#pres_pen_counter_openai').text(Number($(this).val()).toFixed(2));
saveSettingsDebounced();
});
$(document).on('input', '#count_pen', function () {
oai_settings.count_pen = $(this).val();
oai_settings.count_pen = Number($(this).val());
$('#count_pen_counter').text(Number($(this).val()).toFixed(2));
saveSettingsDebounced();
});
$(document).on('input', '#top_p_openai', function () {
oai_settings.top_p_openai = $(this).val();
oai_settings.top_p_openai = Number($(this).val());
$('#top_p_counter_openai').text(Number($(this).val()).toFixed(2));
saveSettingsDebounced();
});
$(document).on('input', '#top_k_openai', function () {
oai_settings.top_k_openai = $(this).val();
oai_settings.top_k_openai = Number($(this).val());
$('#top_k_counter_openai').text(Number($(this).val()).toFixed(0));
saveSettingsDebounced();
});