Use eventSource instead of DOM click
This commit is contained in:
parent
3c059d19ef
commit
3cbbb2fe39
|
@ -2294,14 +2294,13 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
||||||
let imagePath = '';
|
let imagePath = '';
|
||||||
|
|
||||||
const stopListener = () => abortController.abort('Aborted by user');
|
const stopListener = () => abortController.abort('Aborted by user');
|
||||||
const mesStop = document.getElementById('mes_stop');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const combineNegatives = (prefix) => { negativePromptPrefix = combinePrefixes(negativePromptPrefix, prefix); };
|
const combineNegatives = (prefix) => { negativePromptPrefix = combinePrefixes(negativePromptPrefix, prefix); };
|
||||||
const prompt = await getPrompt(generationType, message, trigger, quietPrompt, combineNegatives);
|
const prompt = await getPrompt(generationType, message, trigger, quietPrompt, combineNegatives);
|
||||||
console.log('Processed image prompt:', prompt);
|
console.log('Processed image prompt:', prompt);
|
||||||
|
|
||||||
mesStop?.addEventListener('click', stopListener);
|
eventSource.once(event_types.GENERATION_STOPPED, stopListener);
|
||||||
context.deactivateSendButtons();
|
context.deactivateSendButtons();
|
||||||
hideSwipeButtons();
|
hideSwipeButtons();
|
||||||
|
|
||||||
|
@ -2316,7 +2315,7 @@ async function generatePicture(initiator, args, trigger, message, callback) {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
restoreOriginalDimensions(dimensions);
|
restoreOriginalDimensions(dimensions);
|
||||||
mesStop?.removeEventListener('click', stopListener);
|
eventSource.removeListener(event_types.GENERATION_STOPPED, stopListener);
|
||||||
context.activateSendButtons();
|
context.activateSendButtons();
|
||||||
showSwipeButtons();
|
showSwipeButtons();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue