feat(history): Add 'Send All Enabled Stats on Refresh' option

Adds a new toggle in Edit Trackers -> History Persistence that allows
sending all enabled stats from the preset when using Refresh RPG Info,
instead of only the individually selected persistInHistory fields.

This helps the separate update AI understand the full context of what
has already been tracked and what changes it needs to account for,
improving coherence in stat updates without cluttering the main chat
history with excessive context data.
This commit is contained in:
tomt610
2026-01-11 22:01:26 +00:00
parent c614f7b8dc
commit 3fc2cfa8ab
3 changed files with 63 additions and 21 deletions
+21 -3
View File
@@ -419,7 +419,8 @@ function resetToDefaults() {
enabled: false,
messageCount: 5,
injectionPosition: 'assistant_message_end',
contextPreamble: ''
contextPreamble: '',
sendAllEnabledOnRefresh: false
};
}
@@ -1429,11 +1430,13 @@ function renderHistoryPersistenceTab() {
enabled: false,
messageCount: 5,
injectionPosition: 'assistant_message_end',
contextPreamble: ''
contextPreamble: '',
sendAllEnabledOnRefresh: false
};
const userStatsConfig = extensionSettings.trackerConfig.userStats;
const infoBoxConfig = extensionSettings.trackerConfig.infoBox;
const presentCharsConfig = extensionSettings.trackerConfig.presentCharacters;
const generationMode = extensionSettings.generationMode || 'together';
let html = '<div class="rpg-editor-section">';
@@ -1447,6 +1450,15 @@ function renderHistoryPersistenceTab() {
html += `<label for="rpg-history-persistence-enabled">Enable History Persistence</label>`;
html += '</div>';
// External API Only toggle - only show for separate/external modes
if (generationMode === 'separate' || generationMode === 'external') {
html += '<div class="rpg-editor-toggle-row" style="margin-top: 8px;">';
html += `<input type="checkbox" id="rpg-history-send-all-enabled" ${historyPersistence.sendAllEnabledOnRefresh ? 'checked' : ''}>`;
html += `<label for="rpg-history-send-all-enabled">Send All Enabled Stats on Refresh</label>`;
html += '</div>';
html += `<p class="rpg-editor-hint" style="margin-top: 4px; margin-left: 24px;">When enabled, Refresh RPG Info will include all enabled stats from the preset in history context, ignoring the individual selections below.</p>`;
}
// Message count
html += '<div class="rpg-editor-input-row" style="margin-top: 12px;">';
html += `<label for="rpg-history-message-count">Number of messages to include (0 = all available):</label>`;
@@ -1593,7 +1605,8 @@ function setupHistoryPersistenceListeners() {
enabled: false,
messageCount: 5,
injectionPosition: 'assistant_message_end',
contextPreamble: ''
contextPreamble: '',
externalApiOnly: false
};
}
@@ -1602,6 +1615,11 @@ function setupHistoryPersistenceListeners() {
extensionSettings.historyPersistence.enabled = $(this).is(':checked');
});
// Send All Enabled on Refresh toggle
$('#rpg-history-send-all-enabled').off('change').on('change', function() {
extensionSettings.historyPersistence.sendAllEnabledOnRefresh = $(this).is(':checked');
});
// Message count
$('#rpg-history-message-count').off('change').on('change', function() {
extensionSettings.historyPersistence.messageCount = parseInt($(this).val()) || 0;