Don't auto-swipe on aborted stream

08d177e7ba5bcad5985d135ffe5aeabdee23bd11

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -2Ignore whitespace
public/script.js+4 -2
@@ -3136,7 +3136,8 @@ class StreamingProcessor {
31363136
31373137 //console.log("Generated text size:", text.length, text)
31383138
3139- if (power_user.auto_swipe) {
3139+ const isAborted = this.abortController.signal.aborted;
3140+ if (power_user.auto_swipe && !isAborted) {
31403141 function containsBlacklistedWords(str, blacklist, threshold) {
31413142 const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi');
31423143 const matches = str.match(regex) || [];
@@ -4583,7 +4584,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
45834584 playMessageSound();
45844585 }
45854586
4586- if (power_user.auto_swipe) {
4587+ const isAborted = abortController && abortController.signal.aborted;
4588+ if (power_user.auto_swipe && !isAborted) {
45874589 console.debug('checking for autoswipeblacklist on non-streaming message');
45884590 function containsBlacklistedWords(getMessage, blacklist, threshold) {
45894591 console.debug('checking blacklisted words');