Don't auto-swipe on aborted stream

This commit is contained in:
Cohee 2024-10-28 11:31:15 +00:00
parent 517b140911
commit 08d177e7ba
1 changed files with 4 additions and 2 deletions

View File

@ -3136,7 +3136,8 @@ class StreamingProcessor {
//console.log("Generated text size:", text.length, text) //console.log("Generated text size:", text.length, text)
if (power_user.auto_swipe) { const isAborted = this.abortController.signal.aborted;
if (power_user.auto_swipe && !isAborted) {
function containsBlacklistedWords(str, blacklist, threshold) { function containsBlacklistedWords(str, blacklist, threshold) {
const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi'); const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi');
const matches = str.match(regex) || []; const matches = str.match(regex) || [];
@ -4583,7 +4584,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
playMessageSound(); playMessageSound();
} }
if (power_user.auto_swipe) { const isAborted = abortController && abortController.signal.aborted;
if (power_user.auto_swipe && !isAborted) {
console.debug('checking for autoswipeblacklist on non-streaming message'); console.debug('checking for autoswipeblacklist on non-streaming message');
function containsBlacklistedWords(getMessage, blacklist, threshold) { function containsBlacklistedWords(getMessage, blacklist, threshold) {
console.debug('checking blacklisted words'); console.debug('checking blacklisted words');