From 0ac85ad9fd0043b032e147f4a913bfa84c2764e4 Mon Sep 17 00:00:00 2001 From: Andy Mauragis Date: Thu, 13 Nov 2025 13:45:27 -0500 Subject: [PATCH] feat: Add 'Skip Injections during Guided Generations' setting and UI --- index.js | 6 ++++++ src/core/config.js | 7 +++++++ src/core/state.js | 1 + template.html | 12 ++++++++++++ 4 files changed, 26 insertions(+) diff --git a/index.js b/index.js index cdb4713..46e2b1a 100644 --- a/index.js +++ b/index.js @@ -313,6 +313,11 @@ async function initUI() { saveSettings(); }); + $('#rpg-skip-guided-mode').on('change', function() { + extensionSettings.skipInjectionsForGuided = String($(this).val()); + saveSettings(); + }); + $('#rpg-toggle-plot-buttons').on('change', function() { extensionSettings.enablePlotButtons = $(this).prop('checked'); // console.log('[RPG Companion] Toggle enablePlotButtons changed to:', extensionSettings.enablePlotButtons); @@ -420,6 +425,7 @@ async function initUI() { $('#rpg-custom-text').val(extensionSettings.customColors.text); $('#rpg-custom-highlight').val(extensionSettings.customColors.highlight); $('#rpg-generation-mode').val(extensionSettings.generationMode); + $('#rpg-skip-guided-mode').val(extensionSettings.skipInjectionsForGuided); updatePanelVisibility(); updateSectionVisibility(); diff --git a/src/core/config.js b/src/core/config.js index 184b11d..4901cec 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -34,6 +34,13 @@ export const defaultSettings = { showThoughtsInChat: true, // Show thoughts overlay in chat alwaysShowThoughtBubble: false, // Auto-expand thought bubble without clicking icon enableHtmlPrompt: false, // Enable immersive HTML prompt injection + // Controls when the extension skips injecting tracker instructions/examples/HTML + // into generations that appear to be user-injected instructions. Valid values: + // - 'none' -> never skip (legacy behavior: always inject) + // - 'guided' -> skip for any guided / instruct or quiet_prompt generation + // - 'impersonation' -> skip only for impersonation-style guided generations + // This setting helps compatibility with other extensions like GuidedGenerations. + skipInjectionsForGuided: 'none', enablePlotButtons: true, // Show plot progression buttons above chat input panelPosition: 'right', // 'left', 'right', or 'top' theme: 'default', // Theme: default, sci-fi, fantasy, cyberpunk, custom diff --git a/src/core/state.js b/src/core/state.js index 1a4c190..9c79f73 100644 --- a/src/core/state.js +++ b/src/core/state.js @@ -21,6 +21,7 @@ export let extensionSettings = { showInventory: true, // Show inventory section (v2 system) showThoughtsInChat: true, // Show thoughts overlay in chat enableHtmlPrompt: false, // Enable immersive HTML prompt injection + skipInjectionsForGuided: 'none', // skip injections for instruct injections and quiet prompts (GuidedGenerations compatibility) enablePlotButtons: true, // Show plot progression buttons above chat input panelPosition: 'right', // 'left', 'right', or 'top' theme: 'default', // Theme: default, sci-fi, fantasy, cyberpunk, custom diff --git a/template.html b/template.html index 2f67991..c19a5ec 100644 --- a/template.html +++ b/template.html @@ -255,6 +255,18 @@ Separate mode only. When enabled, tracker generation will use the model from the "RPG Companion Trackers" preset instead of your main API model. The preset will be switched automatically during generation and restored afterward. Select the desired model in that preset and make sure the "Bind presets to API connections" toggle is on (next to the import/export preset buttons). +
+ + +
+ + When set, the extension will not inject tracker prompts, examples, or HTML instructions according to the selected mode when a guided generation (via `instruct` or `quiet_prompt`) is detected. Useful when using GuidedGenerations or similar extensions. + +