mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-02 20:36:49 +01:00
Fix instruct system sequence missing + {{original}}
This commit is contained in:
parent
fad6c164cb
commit
2c2a68ef76
@ -165,6 +165,7 @@ import {
|
|||||||
formatInstructModeExamples,
|
formatInstructModeExamples,
|
||||||
getInstructStoppingSequences,
|
getInstructStoppingSequences,
|
||||||
autoSelectInstructPreset,
|
autoSelectInstructPreset,
|
||||||
|
formatInstructModeSystemPrompt,
|
||||||
} from "./scripts/instruct-mode.js";
|
} from "./scripts/instruct-mode.js";
|
||||||
import { applyLocale } from "./scripts/i18n.js";
|
import { applyLocale } from "./scripts/i18n.js";
|
||||||
import { getTokenCount, getTokenizerModel, saveTokenCache } from "./scripts/tokenizers.js";
|
import { getTokenCount, getTokenizerModel, saveTokenCache } from "./scripts/tokenizers.js";
|
||||||
@ -2360,6 +2361,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
|
|
||||||
if (isInstruct) {
|
if (isInstruct) {
|
||||||
systemPrompt = power_user.prefer_character_prompt && systemPrompt ? systemPrompt : baseChatReplace(power_user.instruct.system_prompt, name1, name2);
|
systemPrompt = power_user.prefer_character_prompt && systemPrompt ? systemPrompt : baseChatReplace(power_user.instruct.system_prompt, name1, name2);
|
||||||
|
systemPrompt = formatInstructModeSystemPrompt(substituteParams(systemPrompt, name1, name2, power_user.instruct.system_prompt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse example messages
|
// Parse example messages
|
||||||
|
@ -189,6 +189,20 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats instruct mode system prompt.
|
||||||
|
* @param {string} systemPrompt System prompt string.
|
||||||
|
* @returns {string} Formatted instruct mode system prompt.
|
||||||
|
*/
|
||||||
|
export function formatInstructModeSystemPrompt(systemPrompt){
|
||||||
|
if (power_user.instruct.system_sequence) {
|
||||||
|
const separator = power_user.instruct.wrap ? '\n' : '';
|
||||||
|
return power_user.instruct.system_sequence + separator + systemPrompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return systemPrompt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats example messages according to instruct mode settings.
|
* Formats example messages according to instruct mode settings.
|
||||||
* @param {string} mesExamples Example messages string.
|
* @param {string} mesExamples Example messages string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user