mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix stopping strings for ooba and kobold
This commit is contained in:
@@ -1021,11 +1021,11 @@ function substituteParams(content, _name1, _name2) {
|
||||
return content;
|
||||
}
|
||||
|
||||
function getStoppingStrings(isImpersonate, wrapInQuotes) {
|
||||
const charString = `\n${name2}: `;
|
||||
const userString = is_pygmalion ? `\nYou: ` : `\n${name1}: `;
|
||||
function getStoppingStrings(isImpersonate, addSpace) {
|
||||
const charString = `\n${name2}:`;
|
||||
const userString = is_pygmalion ? `\nYou:` : `\n${name1}:`;
|
||||
const result = isImpersonate ? charString : userString;
|
||||
return wrapInQuotes ? `"${result}"` : result;
|
||||
return addSpace ? `${result} ` : result;
|
||||
}
|
||||
|
||||
function getSlashCommand(message, type) {
|
||||
@@ -2193,6 +2193,17 @@ function cleanUpMessage(getMessage, isImpersonate) {
|
||||
getMessage = getMessage.trim();
|
||||
}
|
||||
|
||||
const stoppingString = getStoppingStrings(isImpersonate, false);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getMessage;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user