diff --git a/public/script.js b/public/script.js index 331d2b516..d5ed97d4d 100644 --- a/public/script.js +++ b/public/script.js @@ -3764,9 +3764,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro // Determine token limit let this_max_context = getMaxContextSize(); - if (!dryRun && type !== 'quiet') { + if (!dryRun) { console.debug('Running extension interceptors'); - const aborted = await runGenerationInterceptors(coreChat, this_max_context); + const aborted = await runGenerationInterceptors(coreChat, this_max_context, type); if (aborted) { console.debug('Generation aborted by extension interceptors'); diff --git a/public/scripts/extensions.js b/public/scripts/extensions.js index 789540349..307a50721 100644 --- a/public/scripts/extensions.js +++ b/public/scripts/extensions.js @@ -1209,9 +1209,10 @@ async function autoUpdateExtensions(forceAll) { * Runs the generate interceptors for all extensions. * @param {any[]} chat Chat array * @param {number} contextSize Context size + * @param {string} type Generation type * @returns {Promise} True if generation should be aborted */ -export async function runGenerationInterceptors(chat, contextSize) { +export async function runGenerationInterceptors(chat, contextSize, type) { let aborted = false; let exitImmediately = false; @@ -1224,7 +1225,7 @@ export async function runGenerationInterceptors(chat, contextSize) { const interceptorKey = manifest.generate_interceptor; if (typeof globalThis[interceptorKey] === 'function') { try { - await globalThis[interceptorKey](chat, contextSize, abort); + await globalThis[interceptorKey](chat, contextSize, abort, type); } catch (e) { console.error(`Failed running interceptor for ${manifest.display_name}`, e); } diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index 9c3a639b8..1e19cf8b5 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -330,7 +330,18 @@ const defaultSettings = { const writePromptFieldsDebounced = debounce(writePromptFields, debounce_timeout.relaxed); -function processTriggers(chat, _, abort) { +/** + * Generate interceptor for interactive mode triggers. + * @param {any[]} chat Chat messages + * @param {number} _ Context size (unused) + * @param {function(boolean): void} abort Abort generation function + * @param {string} type Type of the generation + */ +function processTriggers(chat, _, abort, type) { + if (type === 'quiet') { + return; + } + if (extension_settings.sd.function_tool && ToolManager.isToolCallingSupported()) { return; } diff --git a/public/scripts/extensions/vectors/index.js b/public/scripts/extensions/vectors/index.js index 28689dccb..475937866 100644 --- a/public/scripts/extensions/vectors/index.js +++ b/public/scripts/extensions/vectors/index.js @@ -594,8 +594,11 @@ async function vectorizeFile(fileText, fileName, collectionId, chunkSize, overla /** * Removes the most relevant messages from the chat and displays them in the extension prompt * @param {object[]} chat Array of chat messages + * @param {number} _contextSize Context size (unused) + * @param {function} _abort Abort function (unused) + * @param {string} type Generation type */ -async function rearrangeChat(chat) { +async function rearrangeChat(chat, _contextSize, _abort, type) { try { // Clear the extension prompt setExtensionPrompt(EXTENSION_PROMPT_TAG, '', settings.position, settings.depth, settings.include_wi); @@ -609,7 +612,7 @@ async function rearrangeChat(chat) { await activateWorldInfo(chat); } - if (!settings.enabled_chats) { + if (!settings.enabled_chats || type === 'quiet') { return; }