mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Move stop strings post-processing up
This commit is contained in:
@ -4068,6 +4068,19 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete
|
|||||||
getMessage = substituteParams(power_user.user_prompt_bias) + getMessage;
|
getMessage = substituteParams(power_user.user_prompt_bias) + getMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stoppingStrings = getStoppingStrings(isImpersonate);
|
||||||
|
|
||||||
|
for (const stoppingString of stoppingStrings) {
|
||||||
|
if (stoppingString.length) {
|
||||||
|
for (let j = stoppingString.length - 1; j > 0; j--) {
|
||||||
|
if (getMessage.slice(-j) === stoppingString.slice(0, j)) {
|
||||||
|
getMessage = getMessage.slice(0, -j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Regex uses vars, so add before formatting
|
// Regex uses vars, so add before formatting
|
||||||
getMessage = getRegexedString(getMessage, isImpersonate ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT);
|
getMessage = getRegexedString(getMessage, isImpersonate ? regex_placement.USER_INPUT : regex_placement.AI_OUTPUT);
|
||||||
|
|
||||||
@ -4155,18 +4168,6 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete
|
|||||||
getMessage = getMessage.trim();
|
getMessage = getMessage.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
const stoppingStrings = getStoppingStrings(isImpersonate);
|
|
||||||
|
|
||||||
for (const stoppingString of stoppingStrings) {
|
|
||||||
if (stoppingString.length) {
|
|
||||||
for (let j = stoppingString.length - 1; j > 0; j--) {
|
|
||||||
if (getMessage.slice(-j) === stoppingString.slice(0, j)) {
|
|
||||||
getMessage = getMessage.slice(0, -j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (power_user.auto_fix_generated_markdown) {
|
if (power_user.auto_fix_generated_markdown) {
|
||||||
getMessage = fixMarkdown(getMessage, false);
|
getMessage = fixMarkdown(getMessage, false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user