#2095 Suppress auto-execution on streamed swiped generations.

This commit is contained in:
Cohee 2024-04-22 16:02:50 +03:00
parent 2f45f50d37
commit 5a5463bd5d
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { chat_metadata, eventSource, event_types, getRequestHeaders } from '../../../script.js';
import { chat, chat_metadata, eventSource, event_types, getRequestHeaders } from '../../../script.js';
import { extension_settings } from '../../extensions.js';
import { QuickReplyApi } from './api/QuickReplyApi.js';
import { AutoExecuteHandler } from './src/AutoExecuteHandler.js';
@ -238,7 +238,12 @@ const onUserMessage = async () => {
};
eventSource.on(event_types.USER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onUserMessage, args));
const onAiMessage = async () => {
const onAiMessage = async (messageId) => {
if (['...'].includes(chat[messageId]?.mes)) {
log('QR auto-execution suppressed for swiped message');
return;
}
await autoExec.handleAi();
};
eventSource.on(event_types.CHARACTER_MESSAGE_RENDERED, (...args)=>executeIfReadyElseQueue(onAiMessage, args));