Merge branch 'staging' of http://github.com/cohee1207/SillyTavern into staging
This commit is contained in:
commit
18bb362578
|
@ -2145,6 +2145,14 @@
|
||||||
Match whole words
|
Match whole words
|
||||||
</small>
|
</small>
|
||||||
</label>
|
</label>
|
||||||
|
<label title="Alert if your world info is greater than the allocated budget."
|
||||||
|
data-i18n="[title]Alert if your world info is greater than the allocated budget."
|
||||||
|
class="checkbox_label">
|
||||||
|
<input id="world_info_overflow_alert" type="checkbox" />
|
||||||
|
<small data-i18n="Alert On Overflow">
|
||||||
|
Alert On Overflow
|
||||||
|
</small>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -3815,6 +3823,10 @@
|
||||||
<i class="fa-lg fa-solid fa-repeat"></i>
|
<i class="fa-lg fa-solid fa-repeat"></i>
|
||||||
<span data-i18n="Regenerate">Regenerate</span>
|
<span data-i18n="Regenerate">Regenerate</span>
|
||||||
</a>
|
</a>
|
||||||
|
<a id="option_settings">
|
||||||
|
<i class="fa-lg fa-solid fa-cog"></i>
|
||||||
|
<span data-i18n="Settings">Settings</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import {
|
||||||
getWorldInfoPrompt,
|
getWorldInfoPrompt,
|
||||||
setWorldInfoSettings,
|
setWorldInfoSettings,
|
||||||
world_info_recursive,
|
world_info_recursive,
|
||||||
|
world_info_overflow_alert,
|
||||||
world_info_case_sensitive,
|
world_info_case_sensitive,
|
||||||
world_info_match_whole_words,
|
world_info_match_whole_words,
|
||||||
world_names,
|
world_names,
|
||||||
|
@ -5077,6 +5078,7 @@ async function saveSettings(type) {
|
||||||
world_info_depth: world_info_depth,
|
world_info_depth: world_info_depth,
|
||||||
world_info_budget: world_info_budget,
|
world_info_budget: world_info_budget,
|
||||||
world_info_recursive: world_info_recursive,
|
world_info_recursive: world_info_recursive,
|
||||||
|
world_info_overflow_alert: world_info_overflow_alert,
|
||||||
world_info_case_sensitive: world_info_case_sensitive,
|
world_info_case_sensitive: world_info_case_sensitive,
|
||||||
world_info_match_whole_words: world_info_match_whole_words,
|
world_info_match_whole_words: world_info_match_whole_words,
|
||||||
world_info_character_strategy: world_info_character_strategy,
|
world_info_character_strategy: world_info_character_strategy,
|
||||||
|
@ -7749,6 +7751,31 @@ $(document).ready(function () {
|
||||||
else if (id == "option_delete_mes") {
|
else if (id == "option_delete_mes") {
|
||||||
setTimeout(openMessageDelete, animation_duration);
|
setTimeout(openMessageDelete, animation_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (id === "option_settings") {
|
||||||
|
//var checkBox = document.getElementById("waifuMode");
|
||||||
|
var topBar = document.getElementById("top-bar");
|
||||||
|
var topSettingsHolder = document.getElementById("top-settings-holder");
|
||||||
|
var divchat = document.getElementById("chat");
|
||||||
|
|
||||||
|
//if (checkBox.checked) {
|
||||||
|
if (topBar.style.display === "none") {
|
||||||
|
topBar.style.display = ""; // or "inline-block" if that's the original display value
|
||||||
|
topSettingsHolder.style.display = ""; // or "inline-block" if that's the original display value
|
||||||
|
|
||||||
|
divchat.style.borderRadius = "";
|
||||||
|
divchat.style.backgroundColor = "";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
divchat.style.borderRadius = "10px"; // Adjust the value to control the roundness of the corners
|
||||||
|
divchat.style.backgroundColor = "#f0f0f0"; // Set the background color to your preference
|
||||||
|
|
||||||
|
topBar.style.display = "none";
|
||||||
|
topSettingsHolder.style.display = "none";
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
hideMenu();
|
hideMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ export {
|
||||||
world_info_budget,
|
world_info_budget,
|
||||||
world_info_depth,
|
world_info_depth,
|
||||||
world_info_recursive,
|
world_info_recursive,
|
||||||
|
world_info_overflow_alert,
|
||||||
world_info_case_sensitive,
|
world_info_case_sensitive,
|
||||||
world_info_match_whole_words,
|
world_info_match_whole_words,
|
||||||
world_info_character_strategy,
|
world_info_character_strategy,
|
||||||
|
@ -32,6 +33,7 @@ let world_names;
|
||||||
let world_info_depth = 2;
|
let world_info_depth = 2;
|
||||||
let world_info_budget = 25;
|
let world_info_budget = 25;
|
||||||
let world_info_recursive = false;
|
let world_info_recursive = false;
|
||||||
|
let world_info_overflow_alert = false;
|
||||||
let world_info_case_sensitive = false;
|
let world_info_case_sensitive = false;
|
||||||
let world_info_match_whole_words = false;
|
let world_info_match_whole_words = false;
|
||||||
let world_info_character_strategy = world_info_insertion_strategy.character_first;
|
let world_info_character_strategy = world_info_insertion_strategy.character_first;
|
||||||
|
@ -70,6 +72,8 @@ function setWorldInfoSettings(settings, data) {
|
||||||
world_info_budget = Number(settings.world_info_budget);
|
world_info_budget = Number(settings.world_info_budget);
|
||||||
if (settings.world_info_recursive !== undefined)
|
if (settings.world_info_recursive !== undefined)
|
||||||
world_info_recursive = Boolean(settings.world_info_recursive);
|
world_info_recursive = Boolean(settings.world_info_recursive);
|
||||||
|
if (settings.world_info_overflow_alert !== undefined)
|
||||||
|
world_info_overflow_alert = Boolean(settings.world_info_overflow_alert);
|
||||||
if (settings.world_info_case_sensitive !== undefined)
|
if (settings.world_info_case_sensitive !== undefined)
|
||||||
world_info_case_sensitive = Boolean(settings.world_info_case_sensitive);
|
world_info_case_sensitive = Boolean(settings.world_info_case_sensitive);
|
||||||
if (settings.world_info_match_whole_words !== undefined)
|
if (settings.world_info_match_whole_words !== undefined)
|
||||||
|
@ -102,6 +106,7 @@ function setWorldInfoSettings(settings, data) {
|
||||||
$("#world_info_budget").val(world_info_budget);
|
$("#world_info_budget").val(world_info_budget);
|
||||||
|
|
||||||
$("#world_info_recursive").prop('checked', world_info_recursive);
|
$("#world_info_recursive").prop('checked', world_info_recursive);
|
||||||
|
$("#world_info_overflow_alert").prop('checked', world_info_overflow_alert);
|
||||||
$("#world_info_case_sensitive").prop('checked', world_info_case_sensitive);
|
$("#world_info_case_sensitive").prop('checked', world_info_case_sensitive);
|
||||||
$("#world_info_match_whole_words").prop('checked', world_info_match_whole_words);
|
$("#world_info_match_whole_words").prop('checked', world_info_match_whole_words);
|
||||||
|
|
||||||
|
@ -1020,6 +1025,10 @@ async function checkWorldInfo(chat, maxContext) {
|
||||||
|
|
||||||
if (textToScanTokens + getTokenCount(newContent) >= budget) {
|
if (textToScanTokens + getTokenCount(newContent) >= budget) {
|
||||||
console.debug(`WI budget reached, stopping`);
|
console.debug(`WI budget reached, stopping`);
|
||||||
|
if (world_info_overflow_alert) {
|
||||||
|
console.log("Alerting");
|
||||||
|
toastr.warning(`World info budget reached after ${count} entries.`, 'World Info');
|
||||||
|
}
|
||||||
needsToScan = false;
|
needsToScan = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1501,6 +1510,11 @@ jQuery(() => {
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#world_info_overflow_alert').on('change', function () {
|
||||||
|
world_info_overflow_alert = $(this).val();
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
|
||||||
$('#world_button').on('click', async function () {
|
$('#world_button').on('click', async function () {
|
||||||
const chid = $('#set_character_world').data('chid');
|
const chid = $('#set_character_world').data('chid');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue