Add Deception System and CYOA features with toggles, custom prompts, and proper injection ordering
This commit is contained in:
+26
-8
@@ -100,6 +100,24 @@ export function loadSettings() {
|
||||
settingsChanged = true;
|
||||
}
|
||||
|
||||
// Migration to version 4: Enable FAB widgets by default
|
||||
if (currentVersion < 4) {
|
||||
// console.log('[RPG Companion] Migrating settings to version 4 (enabling FAB widgets)');
|
||||
if (!extensionSettings.mobileFabWidgets) {
|
||||
extensionSettings.mobileFabWidgets = {};
|
||||
}
|
||||
extensionSettings.mobileFabWidgets.enabled = true;
|
||||
extensionSettings.mobileFabWidgets.weatherIcon = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.weatherDesc = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.clock = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.date = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.location = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.stats = { enabled: true };
|
||||
extensionSettings.mobileFabWidgets.attributes = { enabled: true };
|
||||
extensionSettings.settingsVersion = 4;
|
||||
settingsChanged = true;
|
||||
}
|
||||
|
||||
// Save migrated settings
|
||||
if (settingsChanged) {
|
||||
saveSettings();
|
||||
@@ -741,8 +759,8 @@ export function createPreset(name) {
|
||||
id: presetId,
|
||||
name: name,
|
||||
trackerConfig: JSON.parse(JSON.stringify(extensionSettings.trackerConfig)),
|
||||
historyPersistence: extensionSettings.historyPersistence
|
||||
? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
|
||||
historyPersistence: extensionSettings.historyPersistence
|
||||
? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
|
||||
: null
|
||||
};
|
||||
// Also set it as the active preset so edits go to the new preset
|
||||
@@ -760,8 +778,8 @@ export function saveToPreset(presetId) {
|
||||
const preset = extensionSettings.presetManager.presets[presetId];
|
||||
if (preset) {
|
||||
preset.trackerConfig = JSON.parse(JSON.stringify(extensionSettings.trackerConfig));
|
||||
preset.historyPersistence = extensionSettings.historyPersistence
|
||||
? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
|
||||
preset.historyPersistence = extensionSettings.historyPersistence
|
||||
? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
|
||||
: null;
|
||||
saveSettings();
|
||||
// console.log(`[RPG Companion] Saved current config to preset "${preset.name}"`);
|
||||
@@ -904,7 +922,7 @@ export function hasPresetAssociation() {
|
||||
*/
|
||||
export function autoSwitchPresetForEntity() {
|
||||
const associatedPresetId = getPresetForCurrentEntity();
|
||||
|
||||
|
||||
// If there's a character-specific preset, use it
|
||||
if (associatedPresetId && associatedPresetId !== extensionSettings.presetManager.activePresetId) {
|
||||
// Check if the preset still exists
|
||||
@@ -915,17 +933,17 @@ export function autoSwitchPresetForEntity() {
|
||||
removePresetAssociationForCurrentEntity();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No character association - fall back to default preset if set
|
||||
if (!associatedPresetId) {
|
||||
const defaultPresetId = extensionSettings.presetManager.defaultPresetId;
|
||||
if (defaultPresetId &&
|
||||
if (defaultPresetId &&
|
||||
defaultPresetId !== extensionSettings.presetManager.activePresetId &&
|
||||
extensionSettings.presetManager.presets[defaultPresetId]) {
|
||||
return loadPreset(defaultPresetId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+15
-10
@@ -10,7 +10,7 @@
|
||||
* Extension settings - persisted to SillyTavern settings
|
||||
*/
|
||||
export let extensionSettings = {
|
||||
settingsVersion: 3, // Version number for settings migrations (v3 = JSON format)
|
||||
settingsVersion: 4, // Version number for settings migrations (v4 = FAB widgets enabled by default)
|
||||
enabled: true,
|
||||
autoUpdate: false,
|
||||
updateDepth: 4, // How many messages to include in the context
|
||||
@@ -27,6 +27,10 @@ export let extensionSettings = {
|
||||
customHtmlPrompt: '', // Custom HTML prompt text (empty = use default)
|
||||
enableDialogueColoring: false, // Enable dialogue coloring prompt injection
|
||||
customDialogueColoringPrompt: '', // Custom dialogue coloring prompt text (empty = use default)
|
||||
enableDeceptionSystem: false, // Enable deception tracking with <lie> tags
|
||||
customDeceptionPrompt: '', // Custom deception prompt text (empty = use default)
|
||||
enableCYOA: false, // Enable "Choose Your Own Adventure" formatting with action choices
|
||||
customCYOAPrompt: '', // Custom CYOA prompt text (empty = use default)
|
||||
enableSpotifyMusic: false, // Enable Spotify music integration (asks AI for Spotify URLs)
|
||||
customSpotifyPrompt: '', // Custom Spotify prompt text (empty = use default)
|
||||
|
||||
@@ -34,6 +38,8 @@ export let extensionSettings = {
|
||||
dismissedHolidayPromo: false, // User dismissed the holiday promotion banner
|
||||
showHtmlToggle: true, // Show Immersive HTML toggle in main panel
|
||||
showDialogueColoringToggle: true, // Show Dialogue Coloring toggle in main panel (enabled by default)
|
||||
showDeceptionToggle: true, // Show Deception System toggle in main panel
|
||||
showCYOAToggle: true, // Show CYOA toggle in main panel
|
||||
showSpotifyToggle: true, // Show Spotify Music toggle in main panel
|
||||
|
||||
showDynamicWeatherToggle: true, // Show Dynamic Weather Effects toggle in main panel
|
||||
@@ -42,7 +48,6 @@ export let extensionSettings = {
|
||||
skipInjectionsForGuided: 'none', // skip injections for instruct injections and quiet prompts (GuidedGenerations compatibility)
|
||||
enableRandomizedPlot: true, // Show randomized plot progression button above chat input
|
||||
enableNaturalPlot: true, // Show natural plot progression button above chat input
|
||||
saveTrackerHistory: false, // Save tracker data in chat history for each message
|
||||
// History persistence settings - inject selected tracker data into historical messages
|
||||
historyPersistence: {
|
||||
enabled: false, // Master toggle for history persistence feature
|
||||
@@ -67,14 +72,14 @@ export let extensionSettings = {
|
||||
}, // Saved position for mobile FAB button
|
||||
// Mobile FAB widget display options (8-position system around the button)
|
||||
mobileFabWidgets: {
|
||||
enabled: false, // Master toggle for FAB widgets
|
||||
weatherIcon: { enabled: false, position: 0 }, // Weather emoji (☀️, 🌧️, etc.)
|
||||
weatherDesc: { enabled: false, position: 1 }, // Weather description text
|
||||
clock: { enabled: false, position: 2 }, // Current time display
|
||||
date: { enabled: false, position: 3 }, // Date display
|
||||
location: { enabled: false, position: 4 }, // Location name
|
||||
stats: { enabled: false, position: 5 }, // All stats as compact numbers
|
||||
attributes: { enabled: false, position: 6 } // Compact RPG attributes display
|
||||
enabled: true, // Master toggle for FAB widgets
|
||||
weatherIcon: { enabled: true, position: 0 }, // Weather emoji (☀️, 🌧️, etc.)
|
||||
weatherDesc: { enabled: true, position: 1 }, // Weather description text
|
||||
clock: { enabled: true, position: 2 }, // Current time display
|
||||
date: { enabled: true, position: 3 }, // Date display
|
||||
location: { enabled: true, position: 4 }, // Location name
|
||||
stats: { enabled: true, position: 5 }, // All stats as compact numbers
|
||||
attributes: { enabled: true, position: 6 } // Compact RPG attributes display
|
||||
},
|
||||
userStats: JSON.stringify({
|
||||
stats: [
|
||||
|
||||
Reference in New Issue
Block a user