Move Novel settings to another file

This commit is contained in:
SillyLossy
2023-05-30 18:54:02 +03:00
parent a0090929ae
commit 3a53bc292b
3 changed files with 33 additions and 30 deletions

View File

@@ -82,6 +82,7 @@ import {
} from "./scripts/openai.js";
import {
getNovelGenerationData,
getNovelTier,
loadNovelPreset,
loadNovelSettings,
@@ -3001,36 +3002,6 @@ function setInContextMessages(lastmsg, type) {
$('#chat .mes:not([is_system="true"])').eq(-lastmsg).addClass('lastInContext');
}
// TODO: move to nai-settings.js
function getNovelGenerationData(finalPromt, this_settings, this_amount_gen) {
return {
"input": finalPromt,
"model": nai_settings.model_novel,
"use_string": true,
"temperature": parseFloat(nai_settings.temp_novel),
"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,
//"stop_sequences": {{187}},
//bad_words_ids = {{50256}, {0}, {1}};
//generate_until_sentence = true;
"use_cache": false,
//use_string = true;
"return_full_text": false,
"prefix": "vanilla",
"order": this_settings.order
};
}
function getGenerateUrl() {
let generate_url = '';
if (main_api == 'kobold') {

View File

@@ -130,6 +130,35 @@ const sliders = [
},
];
export function getNovelGenerationData(finalPromt, this_settings, this_amount_gen) {
return {
"input": finalPromt,
"model": nai_settings.model_novel,
"use_string": true,
"temperature": parseFloat(nai_settings.temp_novel),
"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,
//"stop_sequences": {{187}},
//bad_words_ids = {{50256}, {0}, {1}};
//generate_until_sentence = true;
"use_cache": false,
//use_string = true;
"return_full_text": false,
"prefix": "vanilla",
"order": this_settings.order
};
}
$(document).ready(function () {
sliders.forEach(slider => {
$(document).on("input", slider.sliderId, function () {

View File

@@ -580,6 +580,9 @@ app.post("/getstatus", jsonParser, async function (request, response_getstatus =
}
}
client.get(url, args, function (data, response) {
if (typeof data !== 'object') {
data = {};
}
if (response.statusCode == 200) {
data.version = version;
if (data.result != "ReadOnly") {