mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
CFG: Include the entire prompt with negative prompt
CFG with LLMs works differently than stable diffusion. The main principle is prompt mixing and utilizing the differences between the two prompts rather than a full "negative prompt" of what the user doesn't want. SillyTavern its own way of formatting a prompt sent to an LLM backend. Therefore, take that prompt and add negatives to it. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@ -164,6 +164,7 @@ import { deviceInfo } from "./scripts/RossAscends-mods.js";
|
||||
import { registerPromptManagerMigration } from "./scripts/PromptManager.js";
|
||||
import { getRegexedString, regex_placement } from "./scripts/extensions/regex/engine.js";
|
||||
import { FILTER_TYPES, FilterHelper } from "./scripts/filters.js";
|
||||
import { getCfg, getNegativePrompt } from "./scripts/extensions/cfg/util.js";
|
||||
|
||||
//exporting functions and vars for mods
|
||||
export {
|
||||
@ -2905,6 +2906,8 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
let this_amount_gen = parseInt(amount_gen); // how many tokens the AI will be requested to generate
|
||||
let this_settings = koboldai_settings[koboldai_setting_names[preset_settings]];
|
||||
|
||||
const cfgValues = getCfg(finalPromt);
|
||||
|
||||
if (isMultigenEnabled() && type !== 'quiet') {
|
||||
// if nothing has been generated yet..
|
||||
this_amount_gen = getMultigenAmount();
|
||||
@ -2912,6 +2915,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
|
||||
let thisPromptBits = [];
|
||||
|
||||
// TODO: Make this a switch
|
||||
if (main_api == 'koboldhorde' && horde_settings.auto_adjust_response_length) {
|
||||
this_amount_gen = Math.min(this_amount_gen, adjustedParams.maxLength);
|
||||
this_amount_gen = Math.max(this_amount_gen, MIN_AMOUNT_GEN); // prevent validation errors
|
||||
@ -2934,7 +2938,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
}
|
||||
}
|
||||
else if (main_api == 'textgenerationwebui') {
|
||||
generate_data = getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate);
|
||||
generate_data = getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate, cfgValues);
|
||||
generate_data.use_mancer = api_use_mancer_webui;
|
||||
}
|
||||
else if (main_api == 'novel') {
|
||||
|
Reference in New Issue
Block a user