mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Auto-balance quotes on streaming
This commit is contained in:
@@ -1631,10 +1631,13 @@ class StreamingProcessor {
|
|||||||
let isName = result.this_mes_is_name;
|
let isName = result.this_mes_is_name;
|
||||||
processedText = result.getMessage;
|
processedText = result.getMessage;
|
||||||
|
|
||||||
// Predict unbalanced asterisks during streaming
|
// Predict unbalanced asterisks / quotes during streaming
|
||||||
if (!isFinal && isOdd(countOccurrences(processedText, '*'))) {
|
const charsToBalance = ['*', '"'];
|
||||||
// Add asterisk at the end to balance it
|
for (const char of charsToBalance) {
|
||||||
processedText = processedText.trimEnd() + '*';
|
if (!isFinal && isOdd(countOccurrences(processedText, char))) {
|
||||||
|
// Add character at the end to balance it
|
||||||
|
processedText = processedText.trimEnd() + char;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isImpersonate) {
|
if (isImpersonate) {
|
||||||
|
Reference in New Issue
Block a user