From 22ce137caba45740608b5fab137a8fc217cd2722 Mon Sep 17 00:00:00 2001 From: Edward Johan <53343081+younyokel@users.noreply.github.com> Date: Mon, 8 Apr 2024 23:53:58 +0300 Subject: [PATCH] Add support for Agent Scheduler extension --- javascript/prompt_format.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/javascript/prompt_format.js b/javascript/prompt_format.js index a1f573c..5fce7ba 100644 --- a/javascript/prompt_format.js +++ b/javascript/prompt_format.js @@ -226,9 +226,18 @@ onUiLoaded(async () => { tools.after(formatter); ['txt', 'img'].forEach((mode) => { - gradioApp().getElementById(`${mode}2img_generate`).addEventListener('click', () => { - if (autoRun) + const generateButton = gradioApp().getElementById(`${mode}2img_generate`); + const enqueueButton = gradioApp().getElementById(`${mode}2img_enqueue`); + + const handleClick = () => { + if (autoRun) { promptFields.forEach((field) => LeFormatter.formatPipeline(field, dedupe, removeUnderscore, refresh)); - }); + } + }; + + generateButton.addEventListener('click', handleClick); + if (enqueueButton) { + enqueueButton.addEventListener('click', handleClick); + } }); });