mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Auto-complete code blocks during streaming
This commit is contained in:
@ -2185,11 +2185,12 @@ class StreamingProcessor {
|
||||
let processedText = cleanUpMessage(text, isImpersonate, isContinue, !isFinal);
|
||||
|
||||
// Predict unbalanced asterisks / quotes during streaming
|
||||
const charsToBalance = ['*', '"'];
|
||||
const charsToBalance = ['*', '"', '```'];
|
||||
for (const char of charsToBalance) {
|
||||
if (!isFinal && isOdd(countOccurrences(processedText, char))) {
|
||||
// Add character at the end to balance it
|
||||
processedText = processedText.trimEnd() + char;
|
||||
const separator = char.length > 1 ? '\n' : '';
|
||||
processedText = processedText.trimEnd() + separator + char;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user