From 939e938ba2a8b61e6a34844281f4a4886f322f3f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 3 Dec 2023 20:56:25 +0200 Subject: [PATCH] Disallow multiswipe for quiet gens --- public/script.js | 10 +++++----- public/scripts/nai-settings.js | 3 ++- public/scripts/textgen-settings.js | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/public/script.js b/public/script.js index ff4c392ab..c4aff5a9a 100644 --- a/public/script.js +++ b/public/script.js @@ -2774,11 +2774,11 @@ export async function generateRaw(prompt, api, instructOverride) { break; case 'novel': { const novelSettings = novelai_settings[novelai_setting_names[nai_settings.preset_settings_novel]]; - generateData = getNovelGenerationData(prompt, novelSettings, amount_gen, false, false, null); + generateData = getNovelGenerationData(prompt, novelSettings, amount_gen, false, false, null, 'quiet'); break; } case 'textgenerationwebui': - generateData = getTextGenGenerationData(prompt, amount_gen, false, false, null); + generateData = getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet'); break; case 'openai': generateData = [{ role: 'user', content: prompt.trim() }]; @@ -3588,11 +3588,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, } } else if (main_api == 'textgenerationwebui') { - generate_data = getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues); + generate_data = getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type); } else if (main_api == 'novel') { const presetSettings = novelai_settings[novelai_setting_names[nai_settings.preset_settings_novel]]; - generate_data = getNovelGenerationData(finalPrompt, presetSettings, maxLength, isImpersonate, isContinue, cfgValues); + generate_data = getNovelGenerationData(finalPrompt, presetSettings, maxLength, isImpersonate, isContinue, cfgValues, type); } else if (main_api == 'openai') { let [prompt, counts] = await prepareOpenAIMessages({ @@ -4372,7 +4372,7 @@ function extractMessageFromData(data) { function extractMultiSwipes(data, type) { const swipes = []; - if (type === 'continue' || type === 'impersonate') { + if (type === 'continue' || type === 'impersonate' || type === 'quiet') { return swipes; } diff --git a/public/scripts/nai-settings.js b/public/scripts/nai-settings.js index 3d59c6a11..0456d6216 100644 --- a/public/scripts/nai-settings.js +++ b/public/scripts/nai-settings.js @@ -409,7 +409,8 @@ function getBadWordPermutations(text) { return result.filter(onlyUnique); } -export function getNovelGenerationData(finalPrompt, settings, maxLength, isImpersonate, isContinue, cfgValues) { +export function getNovelGenerationData(finalPrompt, settings, maxLength, isImpersonate, isContinue, cfgValues, type) { + console.debug('NovelAI generation data for', type); if (cfgValues && cfgValues.guidanceScale && cfgValues.guidanceScale?.value !== 1) { cfgValues.negativePrompt = (getCfgPrompt(cfgValues.guidanceScale, true))?.value; } diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 03cfd331e..96217e0db 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -586,8 +586,8 @@ function getModel() { return undefined; } -export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues) { - const canMultiSwipe = !isContinue && !isImpersonate; +export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) { + const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet'; let APIflags = { 'prompt': finalPrompt, 'model': getModel(),