mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add single-line mode for Kobold
This commit is contained in:
@ -558,6 +558,10 @@
|
|||||||
<div class="drawer-icon down"></div>
|
<div class="drawer-icon down"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-content">
|
<div class="drawer-content">
|
||||||
|
<label class="checkbox_label" for="single_line">
|
||||||
|
<input id="single_line" type="checkbox" />
|
||||||
|
<h4>Single-line mode</h4>
|
||||||
|
</label>
|
||||||
<div class="range-block">
|
<div class="range-block">
|
||||||
<div class="range-block-title">
|
<div class="range-block-title">
|
||||||
<h4>Top P Sampling</h4>
|
<h4>Top P Sampling</h4>
|
||||||
|
@ -21,6 +21,11 @@
|
|||||||
process. It is important to be careful when making changes to these settings without proper
|
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.
|
consideration, as doing so may result in degraded quality of responses.
|
||||||
</p>
|
</p>
|
||||||
|
<h3>Single-line mode</h3>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
<h3>Top P Sampling</h3>
|
<h3>Top P Sampling</h3>
|
||||||
<p>
|
<p>
|
||||||
This setting controls how much of the text generated is based on the most likely options.
|
This setting controls how much of the text generated is based on the most likely options.
|
||||||
|
@ -846,8 +846,8 @@ function addOneMessage(mes, type = "normal") {
|
|||||||
var $textchat = $("#chat");
|
var $textchat = $("#chat");
|
||||||
$('#chat .mes').last().addClass('last_mes');
|
$('#chat .mes').last().addClass('last_mes');
|
||||||
$('#chat .mes').eq(-2).removeClass('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"]);
|
//console.log(chat[chat.length - 1].["swipes"]);
|
||||||
@ -1397,7 +1397,14 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length
|
|||||||
|
|
||||||
var generate_data;
|
var generate_data;
|
||||||
if (main_api == 'kobold') {
|
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') {
|
if (preset_settings != 'gui') {
|
||||||
|
|
||||||
generate_data = {
|
generate_data = {
|
||||||
@ -1423,6 +1430,7 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length
|
|||||||
s6: this_settings.sampler_order[5],
|
s6: this_settings.sampler_order[5],
|
||||||
s7: this_settings.sampler_order[6],
|
s7: this_settings.sampler_order[6],
|
||||||
use_world_info: false,
|
use_world_info: false,
|
||||||
|
singleline: kai_settings.single_line,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,22 +17,29 @@ const kai_settings = {
|
|||||||
typical: 1,
|
typical: 1,
|
||||||
tfs: 1,
|
tfs: 1,
|
||||||
rep_pen_slope: 0.9,
|
rep_pen_slope: 0.9,
|
||||||
|
single_line: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadKoboldSettings(preset) {
|
function loadKoboldSettings(preset) {
|
||||||
for (const name of Object.keys(kai_settings)) {
|
for (const name of Object.keys(kai_settings)) {
|
||||||
const value = preset[name];
|
const value = preset[name];
|
||||||
|
const slider = sliders.find(x => x.name === name);
|
||||||
|
|
||||||
if (value === undefined) {
|
if (value === undefined || !slider) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const slider = sliders.find(x => x.name === name);
|
|
||||||
const formattedValue = slider.format(value);
|
const formattedValue = slider.format(value);
|
||||||
slider.setValue(preset[name]);
|
slider.setValue(preset[name]);
|
||||||
$(slider.sliderId).val(preset[name]);
|
$(slider.sliderId).val(preset[name]);
|
||||||
$(slider.counterId).text(formattedValue);
|
$(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 = [
|
const sliders = [
|
||||||
@ -111,4 +118,10 @@ $(document).ready(function () {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#single_line').on("input", function() {
|
||||||
|
const value = $(this).prop('checked');
|
||||||
|
kai_settings.single_line = value;
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
});
|
});
|
@ -2822,6 +2822,10 @@ label[for="extensions_autoconnect"] {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.drawer-content .checkbox_label {
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
.extensions_info {
|
.extensions_info {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin: 0 1em;
|
margin: 0 1em;
|
||||||
|
@ -238,7 +238,8 @@ app.post("/generate", jsonParser, async function (request, response_generate = r
|
|||||||
use_memory: false,
|
use_memory: false,
|
||||||
use_authors_note: false,
|
use_authors_note: false,
|
||||||
use_world_info: 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,
|
//temperature: request.body.temperature,
|
||||||
//max_length: request.body.max_length
|
//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_k: request.body.top_k,
|
||||||
top_p: request.body.top_p,
|
top_p: request.body.top_p,
|
||||||
typical: request.body.typical,
|
typical: request.body.typical,
|
||||||
sampler_order: sampler_order
|
sampler_order: sampler_order,
|
||||||
|
singleline: !!request.body.singleline,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user