#1436 Add unlock to response length

This commit is contained in:
Cohee 2023-12-03 18:30:21 +02:00
parent 40b132176d
commit 676cc7731e
3 changed files with 18 additions and 6 deletions

View File

@ -76,6 +76,7 @@ import {
loadMovingUIState, loadMovingUIState,
getCustomStoppingStrings, getCustomStoppingStrings,
MAX_CONTEXT_DEFAULT, MAX_CONTEXT_DEFAULT,
MAX_RESPONSE_DEFAULT,
renderStoryString, renderStoryString,
sortEntitiesList, sortEntitiesList,
registerDebugFunction, registerDebugFunction,
@ -5618,6 +5619,9 @@ async function saveSettings(type) {
} }
export function setGenerationParamsFromPreset(preset) { export function setGenerationParamsFromPreset(preset) {
const needsUnlock = preset.max_length > MAX_CONTEXT_DEFAULT || preset.genamt > MAX_RESPONSE_DEFAULT;
$('#max_context_unlocked').prop('checked', needsUnlock).trigger('change');
if (preset.genamt !== undefined) { if (preset.genamt !== undefined) {
amount_gen = preset.genamt; amount_gen = preset.genamt;
$('#amount_gen').val(amount_gen); $('#amount_gen').val(amount_gen);
@ -5625,10 +5629,7 @@ export function setGenerationParamsFromPreset(preset) {
} }
if (preset.max_length !== undefined) { if (preset.max_length !== undefined) {
const needsUnlock = preset.max_length > MAX_CONTEXT_DEFAULT;
$('#max_context_unlocked').prop('checked', needsUnlock).trigger('change');
max_context = preset.max_length; max_context = preset.max_length;
$('#max_context').val(max_context); $('#max_context').val(max_context);
$('#max_context_counter').val(max_context); $('#max_context_counter').val(max_context);
} }

View File

@ -8,7 +8,7 @@ import {
substituteParams, substituteParams,
} from '../script.js'; } from '../script.js';
import { getCfgPrompt } from './cfg-scale.js'; import { getCfgPrompt } from './cfg-scale.js';
import { MAX_CONTEXT_DEFAULT } from './power-user.js'; import { MAX_CONTEXT_DEFAULT, MAX_RESPONSE_DEFAULT } from './power-user.js';
import { getTextTokens, tokenizers } from './tokenizers.js'; import { getTextTokens, tokenizers } from './tokenizers.js';
import { import {
getSortableDelay, getSortableDelay,
@ -106,7 +106,7 @@ export async function loadNovelSubscriptionData() {
export function loadNovelPreset(preset) { export function loadNovelPreset(preset) {
if (preset.genamt === undefined) { if (preset.genamt === undefined) {
const needsUnlock = preset.max_context > MAX_CONTEXT_DEFAULT; const needsUnlock = preset.max_context > MAX_CONTEXT_DEFAULT || preset.max_length > MAX_RESPONSE_DEFAULT;
$('#amount_gen').val(preset.max_length).trigger('input'); $('#amount_gen').val(preset.max_length).trigger('input');
$('#max_context_unlocked').prop('checked', needsUnlock).trigger('change'); $('#max_context_unlocked').prop('checked', needsUnlock).trigger('change');
$('#max_context').val(preset.max_context).trigger('input'); $('#max_context').val(preset.max_context).trigger('input');

View File

@ -48,7 +48,9 @@ export {
}; };
export const MAX_CONTEXT_DEFAULT = 8192; export const MAX_CONTEXT_DEFAULT = 8192;
const MAX_CONTEXT_UNLOCKED = 200 * 1000; export const MAX_RESPONSE_DEFAULT = 2048;
const MAX_CONTEXT_UNLOCKED = 200 * 1024;
const MAX_RESPONSE_UNLOCKED = 16 * 1024;
const unlockedMaxContextStep = 512; const unlockedMaxContextStep = 512;
const maxContextMin = 512; const maxContextMin = 512;
const maxContextStep = 256; const maxContextStep = 256;
@ -1552,6 +1554,15 @@ function switchMaxContextSize() {
element.val(maxValue).trigger('input'); element.val(maxValue).trigger('input');
} }
} }
const maxAmountGen = power_user.max_context_unlocked ? MAX_RESPONSE_UNLOCKED : MAX_RESPONSE_DEFAULT;
$('#amount_gen').attr('max', maxAmountGen);
$('#amount_gen_counter').attr('max', maxAmountGen);
if (Number($('#amount_gen').val()) >= maxAmountGen) {
$('#amount_gen').val(maxAmountGen).trigger('input');
}
if (power_user.enableZenSliders) { if (power_user.enableZenSliders) {
$('#max_context_zenslider').remove(); $('#max_context_zenslider').remove();
CreateZenSliders($('#max_context')); CreateZenSliders($('#max_context'));