Merge branch 'staging' into wi-processing-refactoring

This commit is contained in:
Cohee
2024-07-06 14:58:48 +03:00
13 changed files with 118 additions and 22 deletions

View File

@ -24,6 +24,7 @@ export {
world_info_depth,
world_info_min_activations,
world_info_min_activations_depth_max,
world_info_include_names,
world_info_recursive,
world_info_overflow_alert,
world_info_case_sensitive,
@ -83,6 +84,7 @@ let world_info_min_activations = 0; // if > 0, will continue seeking chat until
let world_info_min_activations_depth_max = 0; // used when (world_info_min_activations > 0)
let world_info_budget = 25;
let world_info_include_names = true;
let world_info_recursive = false;
let world_info_overflow_alert = false;
let world_info_case_sensitive = false;
@ -718,6 +720,7 @@ export function getWorldInfoSettings() {
world_info_min_activations,
world_info_min_activations_depth_max,
world_info_budget,
world_info_include_names,
world_info_recursive,
world_info_overflow_alert,
world_info_case_sensitive,
@ -747,7 +750,7 @@ const worldInfoCache = new Map();
/**
* Gets the world info based on chat messages.
* @param {string[]} chat The chat messages to scan.
* @param {string[]} chat The chat messages to scan, in reverse order.
* @param {number} maxContext The maximum context size of the generation.
* @param {boolean} isDryRun If true, the function will not emit any events.
* @typedef {{worldInfoString: string, worldInfoBefore: string, worldInfoAfter: string, worldInfoExamples: any[], worldInfoDepth: any[]}} WIPromptResult
@ -784,6 +787,8 @@ function setWorldInfoSettings(settings, data) {
world_info_min_activations_depth_max = Number(settings.world_info_min_activations_depth_max);
if (settings.world_info_budget !== undefined)
world_info_budget = Number(settings.world_info_budget);
if (settings.world_info_include_names !== undefined)
world_info_include_names = Boolean(settings.world_info_include_names);
if (settings.world_info_recursive !== undefined)
world_info_recursive = Boolean(settings.world_info_recursive);
if (settings.world_info_overflow_alert !== undefined)
@ -833,6 +838,7 @@ function setWorldInfoSettings(settings, data) {
$('#world_info_budget_counter').val(world_info_budget);
$('#world_info_budget').val(world_info_budget);
$('#world_info_include_names').prop('checked', world_info_include_names);
$('#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);
@ -3542,7 +3548,7 @@ export async function getSortedEntries() {
/**
* Performs a scan on the chat and returns the world info activated.
* @param {string[]} chat The chat messages to scan.
* @param {string[]} chat The chat messages to scan, in reverse order.
* @param {number} maxContext The maximum context size of the generation.
* @param {boolean} isDryRun Whether to perform a dry run.
* @typedef {{ worldInfoBefore: string, worldInfoAfter: string, EMEntries: any[], WIDepthEntries: any[], allActivatedEntries: Set<any> }} WIActivated
@ -4637,6 +4643,11 @@ jQuery(() => {
saveSettings();
});
$('#world_info_include_names').on('input', function () {
world_info_include_names = !!$(this).prop('checked');
saveSettings();
});
$('#world_info_recursive').on('input', function () {
world_info_recursive = !!$(this).prop('checked');
saveSettings();