Option to unlock max context size

This commit is contained in:
SillyLossy
2023-05-11 00:25:08 +03:00
parent ee8ae7e9c6
commit 18429bbc3b
4 changed files with 58 additions and 6 deletions

View File

@@ -175,6 +175,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="max_context_unlocked_block">
<label class="checkbox_label">
<input id="max_context_unlocked" type="checkbox" />
Unlocked
<div id="max_context_unlocked_warning">
<b class="neutral_warning">ATTENTION!</b>
Only select models support context sizes greater than 2048 tokens.
Proceed only if you know what you're doing.
</div>
</label>
</div>
</div> </div>
<hr> <hr>
</div> </div>

View File

@@ -3235,12 +3235,6 @@ async function getSettings(type) {
"true" "true"
); );
$("#max_context").val(max_context);
$("#max_context_counter").text(`${max_context}`);
$("#amount_gen").val(amount_gen);
$("#amount_gen_counter").text(`${amount_gen}`);
swipes = settings.swipes !== undefined ? !!settings.swipes : true; // enable swipes by default swipes = settings.swipes !== undefined ? !!settings.swipes : true; // enable swipes by default
$('#swipes-checkbox').prop('checked', swipes); /// swipecode $('#swipes-checkbox').prop('checked', swipes); /// swipecode
//console.log('getSettings -- swipes = ' + swipes + '. toggling box'); //console.log('getSettings -- swipes = ' + swipes + '. toggling box');
@@ -3272,6 +3266,13 @@ async function getSettings(type) {
// Load- character tags // Load- character tags
loadTagsSettings(settings); loadTagsSettings(settings);
// Set context size after loading power user (may override the max value)
$("#max_context").val(max_context);
$("#max_context_counter").text(`${max_context}`);
$("#amount_gen").val(amount_gen);
$("#amount_gen_counter").text(`${amount_gen}`);
//Enable GUI deference settings if GUI is selected for Kobold //Enable GUI deference settings if GUI is selected for Kobold
if (main_api === "kobold") { if (main_api === "kobold") {
} }

View File

@@ -27,6 +27,9 @@ export {
send_on_enter_options, send_on_enter_options,
}; };
const MAX_CONTEXT_DEFAULT = 2048;
const MAX_CONTEXT_UNLOCKED = 65536;
const avatar_styles = { const avatar_styles = {
ROUND: 0, ROUND: 0,
RECTANGULAR: 1, RECTANGULAR: 1,
@@ -111,6 +114,7 @@ let power_user = {
allow_name2_display: false, allow_name2_display: false,
hotswap_enabled: true, hotswap_enabled: true,
timer_enabled: true, timer_enabled: true,
max_context_unlocked: false,
instruct: { instruct: {
enabled: false, enabled: false,
@@ -534,6 +538,28 @@ function loadPowerUserSettings(settings, data) {
sortCharactersList(); sortCharactersList();
reloadMarkdownProcessor(power_user.render_formulas); reloadMarkdownProcessor(power_user.render_formulas);
loadInstructMode(); loadInstructMode();
loadMaxContextUnlocked();
}
function loadMaxContextUnlocked() {
$('#max_context_unlocked').prop('checked', power_user.max_context_unlocked);
$('#max_context_unlocked').on('change', function() {
power_user.max_context_unlocked = !!$(this).prop('checked');
switchMaxContextSize();
saveSettingsDebounced();
});
switchMaxContextSize();
}
function switchMaxContextSize() {
const element = $('#max_context');
const maxValue = power_user.max_context_unlocked ? MAX_CONTEXT_UNLOCKED : MAX_CONTEXT_DEFAULT;
element.attr('max', maxValue);
const value = Number(element.val());
if (value >= maxValue) {
element.val(maxValue).trigger('input');
}
} }
function loadInstructMode() { function loadInstructMode() {

View File

@@ -1923,6 +1923,7 @@ input[type='checkbox']:not(#nav-toggle):not(#rm_button_panel_pin):not(#lm_button
display: flex; display: flex;
grid-gap: 10px; grid-gap: 10px;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-evenly;
} }
#user_avatar_block .avatar { #user_avatar_block .avatar {
@@ -3673,6 +3674,18 @@ toolcool-color-picker {
color: rgba(255, 0, 0, 0.5) color: rgba(255, 0, 0, 0.5)
} }
.max_context_unlocked_block .checkbox_label {
flex-wrap: wrap;
}
#max_context_unlocked_warning {
flex-basis: 100%;
}
#max_context_unlocked:not(:checked) + div {
display: none;
}
.textarea_compact { .textarea_compact {
font-size: calc(var(--mainFontSize) * 0.9); font-size: calc(var(--mainFontSize) * 0.9);
line-height: 1.2; line-height: 1.2;