diff --git a/index.js b/index.js index 49b3032..3ac4893 100644 --- a/index.js +++ b/index.js @@ -53,7 +53,7 @@ const image_search_tab = require('./utility/tab/image_search_tab') let g_horde_generator = new horde_native.hordeGenerator() let g_automatic_status = Enum.AutomaticStatusEnum['Offline'] let g_models_status = false - +let g_current_batch_index = 0 //REFACTOR: move to session.js async function hasSessionSelectionChanged() { try { @@ -1825,7 +1825,20 @@ async function getSettings() { const upscaler = document.querySelector('#hrModelsMenu').value const cfg_scale = document.querySelector('#slCfgScale').value // const model_index = document.querySelector("#") - const seed = document.querySelector('#tiSeed').value + + function calculateSeed(init_seed, batch_index, batch_size) { + if (init_seed === -1) return -1 + const seed = init_seed + batch_index * batch_size + return seed + } + + const init_seed = parseInt(document.querySelector('#tiSeed').value) + const seed = calculateSeed( + init_seed, + g_current_batch_index, + numberOfBatchSize + ) + // const mask_blur = document.querySelector('#slMaskBlur').value const use_sharp_mask = settings_tab.getUseSharpMask() const mask_blur = html_manip.getMaskBlur() @@ -2583,9 +2596,11 @@ Array.from(document.getElementsByClassName('btnGenerateClass')).forEach( if (g_batch_count_interrupt_status === true) { break } + g_current_batch_index = i await easyModeGenerate(g_sd_mode) } g_batch_count_interrupt_status = false // reset for next generation + g_current_batch_index = 0 // reset curent_batch_number }) } ) //REFACTOR: move to events.js