Don't auto-swipe on aborted stream

08d177e7ba5bcad5985d135ffe5aeabdee23bd11

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

1 files changed, +4 -2Showing whitespace changes
public/script.js+4 -2
@@ -3136,7 +3136,8 @@ class StreamingProcessor {
31363136
3137 //console.log("Generated text size:", text.length, text)3137 //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) {
3140 function containsBlacklistedWords(str, blacklist, threshold) {3141 function containsBlacklistedWords(str, blacklist, threshold) {
3141 const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi');3142 const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi');
3142 const matches = str.match(regex) || [];3143 const matches = str.match(regex) || [];
@@ -4583,7 +4584,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
4583 playMessageSound();4584 playMessageSound();
4584 }4585 }
45854586
4586 if (power_user.auto_swipe) {4587 const isAborted = abortController && abortController.signal.aborted;
4588 if (power_user.auto_swipe && !isAborted) {
4587 console.debug('checking for autoswipeblacklist on non-streaming message');4589 console.debug('checking for autoswipeblacklist on non-streaming message');
4588 function containsBlacklistedWords(getMessage, blacklist, threshold) {4590 function containsBlacklistedWords(getMessage, blacklist, threshold) {
4589 console.debug('checking blacklisted words');4591 console.debug('checking blacklisted words');