Move stop strings post-processing up
This commit is contained in:
parent
0effbebae7
commit
1a3f100018
|
@ -4068,6 +4068,19 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete
|
|||
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
|
||||
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();
|
||||
}
|
||||
|
||||
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) {
|
||||
getMessage = fixMarkdown(getMessage, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue