diff --git a/public/index.html b/public/index.html index c250aabd5..cac0945a4 100644 --- a/public/index.html +++ b/public/index.html @@ -558,6 +558,10 @@
+

Top P Sampling

diff --git a/public/notes/kai_advanced.html b/public/notes/kai_advanced.html index 387d437e4..6b6a822c9 100644 --- a/public/notes/kai_advanced.html +++ b/public/notes/kai_advanced.html @@ -21,6 +21,11 @@ process. It is important to be careful when making changes to these settings without proper consideration, as doing so may result in degraded quality of responses.

+

Single-line mode

+

+ In single-line mode the AI generates only one line per request. This allows for quicker generation of + shorter prompts, but it does not produce responses that consist of more than one line. +

Top P Sampling

This setting controls how much of the text generated is based on the most likely options. diff --git a/public/script.js b/public/script.js index dd42bf12b..a266004e6 100644 --- a/public/script.js +++ b/public/script.js @@ -846,8 +846,8 @@ function addOneMessage(mes, type = "normal") { var $textchat = $("#chat"); $('#chat .mes').last().addClass('last_mes'); $('#chat .mes').eq(-2).removeClass('last_mes'); - $textchat.scrollTop(($textchat[0].scrollHeight)); - + //$textchat.scrollTop(($textchat[0].scrollHeight)); + $('#chat .mes').last().get(0).scrollIntoView({ behavior: "smooth" }); //console.log(chat[chat.length - 1].["swipes"]); @@ -1397,7 +1397,14 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length var generate_data; if (main_api == 'kobold') { - var generate_data = { prompt: finalPromt, gui_settings: true, max_length: amount_gen, temperature: kai_settings.temp, max_context_length: max_context }; + var generate_data = { + prompt: finalPromt, + gui_settings: true, + max_length: amount_gen, + temperature: kai_settings.temp, + max_context_length: max_context, + singleline: kai_settings.single_line, + }; if (preset_settings != 'gui') { generate_data = { @@ -1423,6 +1430,7 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length s6: this_settings.sampler_order[5], s7: this_settings.sampler_order[6], use_world_info: false, + singleline: kai_settings.single_line, }; } } diff --git a/public/scripts/kai-settings.js b/public/scripts/kai-settings.js index bda6dd18f..4d4137149 100644 --- a/public/scripts/kai-settings.js +++ b/public/scripts/kai-settings.js @@ -17,22 +17,29 @@ const kai_settings = { typical: 1, tfs: 1, rep_pen_slope: 0.9, + single_line: false, }; function loadKoboldSettings(preset) { for (const name of Object.keys(kai_settings)) { const value = preset[name]; + const slider = sliders.find(x => x.name === name); - if (value === undefined) { + if (value === undefined || !slider) { continue; } - const slider = sliders.find(x => x.name === name); const formattedValue = slider.format(value); slider.setValue(preset[name]); $(slider.sliderId).val(preset[name]); $(slider.counterId).text(formattedValue); } + + // TODO: refactor checkboxes (if adding any more) + if (preset.hasOwnProperty('single_line')) { + kai_settings.single_line = preset.single_line; + $('#single_line').prop('checked', kai_settings.single_line); + } } const sliders = [ @@ -111,4 +118,10 @@ $(document).ready(function () { saveSettingsDebounced(); }); }); + + $('#single_line').on("input", function() { + const value = $(this).prop('checked'); + kai_settings.single_line = value; + saveSettingsDebounced(); + }); }); \ No newline at end of file diff --git a/public/style.css b/public/style.css index 8ebbd4781..d4f41d071 100644 --- a/public/style.css +++ b/public/style.css @@ -2822,6 +2822,10 @@ label[for="extensions_autoconnect"] { display: none; } +.drawer-content .checkbox_label { + margin: 1rem 0; +} + .extensions_info { text-align: left; margin: 0 1em; diff --git a/server.js b/server.js index ea1b17864..87506c61b 100644 --- a/server.js +++ b/server.js @@ -238,7 +238,8 @@ app.post("/generate", jsonParser, async function (request, response_generate = r use_memory: false, use_authors_note: false, use_world_info: false, - max_context_length: request.body.max_context_length + max_context_length: request.body.max_context_length, + singleline: !!request.body.singleline, //temperature: request.body.temperature, //max_length: request.body.max_length }; @@ -262,7 +263,8 @@ app.post("/generate", jsonParser, async function (request, response_generate = r top_k: request.body.top_k, top_p: request.body.top_p, typical: request.body.typical, - sampler_order: sampler_order + sampler_order: sampler_order, + singleline: !!request.body.singleline, }; }