Extensions: Add global CFG support

CFG is bundled as an extension which is more flexible in terms of
storing settings and consolidating code.

Global CFG is currently supported and the old power user setting
is auto-migrated.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-08-08 23:22:25 -04:00
parent d18bd20d75
commit 0c94740560
8 changed files with 314 additions and 3 deletions

View File

@ -6,6 +6,8 @@ import {
setGenerationParamsFromPreset,
} from "../script.js";
import { getCfg } from "./extensions/cfg/util.js";
import {
power_user,
} from "./power-user.js";
@ -230,6 +232,8 @@ async function generateTextGenWithStreaming(generate_data, signal) {
}
export function getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate) {
const { guidanceScale, negativePrompt } = getCfg();
return {
'prompt': finalPromt,
'max_new_tokens': this_amount_gen,
@ -247,6 +251,8 @@ export function getTextGenGenerationData(finalPromt, this_amount_gen, isImperson
'penalty_alpha': textgenerationwebui_settings.penalty_alpha,
'length_penalty': textgenerationwebui_settings.length_penalty,
'early_stopping': textgenerationwebui_settings.early_stopping,
'guidance_scale': guidanceScale ?? 1,
'negative_prompt': negativePrompt ?? '',
'seed': textgenerationwebui_settings.seed,
'add_bos_token': textgenerationwebui_settings.add_bos_token,
'stopping_strings': getStoppingStrings(isImpersonate, false),