parent
4a0d45bdc8
commit
745d541a62
37
index.js
37
index.js
|
|
@ -43,8 +43,7 @@ let g_online_data_url =
|
|||
const Enum = require('./enum')
|
||||
const helper = require('./helper')
|
||||
const sd_tab = require('./utility/tab/sd')
|
||||
// let g_sdapi_path = 'sdapi_py_re'
|
||||
// const sdapi = require(`./${g_sdapi_path}`)
|
||||
|
||||
const sdapi = require('./sdapi_py_re')
|
||||
|
||||
// const exportHelper = require('./export_png')
|
||||
|
|
@ -871,7 +870,6 @@ async function deleteTempInpaintMaskLayer() {
|
|||
}
|
||||
//REFACTOR: move to ui.js
|
||||
async function postModeSelection() {
|
||||
//
|
||||
try {
|
||||
if (g_sd_mode === generationMode['Inpaint']) {
|
||||
//check if the we already have created a mask layer
|
||||
|
|
@ -1214,34 +1212,6 @@ function selectTool() {
|
|||
//rectanglemarquee
|
||||
// await require('photoshop').core.executeAsModal(newNormalLayer);
|
||||
}
|
||||
//Refactor: Delete testServerPath() method
|
||||
async function testServerPath() {
|
||||
// const serverPath = "https://api.github.com/users/abdullah"
|
||||
|
||||
try {
|
||||
// const serverPath = 'https://api.weather.gov/points/123.4,342.5'
|
||||
// const serverPath = 'https://api.github.com/users/abdullah'
|
||||
// const serverPath = "https://api.coindesk.com/v1/bpi/currentprice.json"
|
||||
// const serverPath = "http://127.0.0.1:3000"
|
||||
// const serverPath = "http://localhost:3000"
|
||||
const serverPath = 'http://127.0.0.1:8000/txt2img/random%20prompt'
|
||||
// const serverPath = "https://3330-37-106-100-102.eu.ngrok.io"
|
||||
console.log('testServerPath function was called')
|
||||
|
||||
let response = await fetch(serverPath)
|
||||
console.log('testServerPath finished fetch')
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`HTTP error fetching weather station; status: ${response.status}`
|
||||
)
|
||||
}
|
||||
let stationJson = await response.json()
|
||||
console.dir(stationJson)
|
||||
} catch (err) {
|
||||
console.error('testServerPath error: ' + err.message)
|
||||
}
|
||||
}
|
||||
|
||||
// User picks an image file
|
||||
// open a explorer for user to select a image file
|
||||
|
|
@ -2465,7 +2435,7 @@ async function easyModeGenerate(mode) {
|
|||
|
||||
if (g_generation_session.isActive()) {
|
||||
//active session
|
||||
//
|
||||
|
||||
if (g_generation_session.mode !== mode) {
|
||||
//active session but it's a new mode
|
||||
|
||||
|
|
@ -2904,7 +2874,7 @@ async function progressRecursive() {
|
|||
if (g_generation_session.sudo_timer_id) {
|
||||
//for sudo timer update
|
||||
//for controlnet only: disable the sudo timer when the real timer start
|
||||
// debugger
|
||||
//
|
||||
if (progress_value > 1) {
|
||||
//disable the sudo timer at the end of the generation
|
||||
g_generation_session.sudo_timer_id = clearInterval(
|
||||
|
|
@ -4001,7 +3971,6 @@ async function deleteNoneSelected(viewer_objects) {
|
|||
g_viewer_manager.pathToViewerImage = {}
|
||||
g_viewer_manager.initImageLayersJson = {}
|
||||
g_viewer_manager.outputImages = []
|
||||
//
|
||||
|
||||
g_generation_session.image_paths_to_layers = {}
|
||||
})
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -277,8 +277,6 @@ async function outpaintExe(session_id) {
|
|||
|
||||
await psapi.reSelectMarqueeExe(selectionInfo)
|
||||
|
||||
// await psapi.silentSetInitImageMask(snapshotMaskGroup,session_id)
|
||||
|
||||
const mask_name = mask_info['name']
|
||||
const mask_path = `./server/python_server/init_images/${mask_name}`
|
||||
await psapi.reSelectMarqueeExe(selectionInfo)
|
||||
|
|
@ -332,7 +330,6 @@ async function outpaintExe(session_id) {
|
|||
}
|
||||
|
||||
async function inpaintFasterExe(session_id) {
|
||||
//
|
||||
//create a snapshot of canvas
|
||||
//select opaque pixel and create black fill layer
|
||||
//create a snapshot of mask
|
||||
|
|
@ -432,7 +429,7 @@ async function inpaintFasterExe(session_id) {
|
|||
// await psapi.selectLayers([snapshotGroup])
|
||||
|
||||
await psapi.selectLayers([maskGroup])
|
||||
// await psapi.silentSetInitImageMask(maskGroup,session_id)
|
||||
|
||||
const mask_info = await psapi.silentSetInitImageMask(
|
||||
maskGroup,
|
||||
session_id
|
||||
|
|
|
|||
92
psapi.js
92
psapi.js
|
|
@ -906,96 +906,6 @@ async function silentSetInitImageMask(layer, session_id) {
|
|||
console.error(`psapi.js setInitImageMask error: `, e)
|
||||
}
|
||||
}
|
||||
async function setInitImage(layer, session_id) {
|
||||
try {
|
||||
const html_manip = require('./utility/html_manip')
|
||||
// const layer = await app.activeDocument.activeLayers[0]
|
||||
const old_name = layer.name
|
||||
|
||||
// image_name = await app.activeDocument.activeLayers[0].name
|
||||
|
||||
//convert layer name to a file name
|
||||
let image_name = layerNameToFileName(old_name, layer.id, session_id)
|
||||
image_name = `${image_name}.png`
|
||||
|
||||
//the width and height of the exported image
|
||||
const width = html_manip.getWidth()
|
||||
const height = html_manip.getHeight()
|
||||
const image_buffer = await newExportPng(
|
||||
layer,
|
||||
image_name,
|
||||
width,
|
||||
height
|
||||
)
|
||||
const base64_image = _arrayBufferToBase64(image_buffer) //convert the buffer to base64
|
||||
//send the base64 to the server to save the file in the desired directory
|
||||
await sdapi.requestSavePng(base64_image, image_name)
|
||||
|
||||
g_init_image_name = image_name
|
||||
console.log(image_name)
|
||||
|
||||
const image_src = await sdapi.getInitImage(g_init_image_name)
|
||||
let ini_image_element = document.getElementById('init_image')
|
||||
ini_image_element.src = image_src
|
||||
const path = `${g_init_images_dir}/${image_name}`
|
||||
|
||||
g_generation_session.base64initImages[path] = base64_image
|
||||
g_generation_session.activeBase64InitImage =
|
||||
g_generation_session.base64initImages[path]
|
||||
|
||||
const init_src = base64ToSrc(g_generation_session.activeBase64InitImage)
|
||||
html_manip.setInitImageSrc(init_src)
|
||||
|
||||
return (image_info = { name: image_name, base64: base64_image })
|
||||
} catch (e) {
|
||||
console.error(`psapi.js setInitImage error:, ${e}`)
|
||||
}
|
||||
}
|
||||
async function setInitImageMask(layer, session_id) {
|
||||
try {
|
||||
const html_manip = require('./utility/html_manip')
|
||||
|
||||
// const layer = await app.activeDocument.activeLayers[0]
|
||||
const old_name = layer.name
|
||||
|
||||
//get the active layer name
|
||||
// image_name = await app.activeDocument.activeLayers[0].name
|
||||
// image_name = layerNameToFileName(old_name,layer.id,random_session_id)
|
||||
image_name = layerNameToFileName(old_name, layer.id, session_id)
|
||||
image_name = `${image_name}.png`
|
||||
const width = html_manip.getWidth()
|
||||
const height = html_manip.getHeight()
|
||||
image_buffer = await newExportPng(layer, image_name, width, height)
|
||||
g_init_image_mask_name = image_name // this is the name we will send to the server
|
||||
// g_init_mask_layer = layer
|
||||
// g_mask_related_layers = {}
|
||||
|
||||
console.log(image_name)
|
||||
base64_image = _arrayBufferToBase64(image_buffer) //convert the buffer to base64
|
||||
//send the base64 to the server to save the file in the desired directory
|
||||
await sdapi.requestSavePng(base64_image, image_name)
|
||||
|
||||
const image_src = await sdapi.getInitImage(g_init_image_mask_name) // we should replace this with getInitImagePath which return path to local disk
|
||||
const ini_image_mask_element =
|
||||
document.getElementById('init_image_mask')
|
||||
ini_image_mask_element.src = image_src
|
||||
ini_image_mask_element.dataset.layer_id = layer.id
|
||||
|
||||
const path = `${g_init_images_dir}/${image_name}`
|
||||
g_generation_session.base64maskImage[path] = base64_image
|
||||
g_generation_session.activeBase64MaskImage =
|
||||
g_generation_session.base64maskImage[path]
|
||||
//create viewer init image obj
|
||||
{
|
||||
}
|
||||
// return image_name
|
||||
const mask_src = base64ToSrc(g_generation_session.activeBase64MaskImage)
|
||||
html_manip.setInitImageMaskSrc(mask_src)
|
||||
return (image_info = { name: image_name, base64: base64_image })
|
||||
} catch (e) {
|
||||
console.error(`psapi.js setInitImageMask error: `, e)
|
||||
}
|
||||
}
|
||||
|
||||
// remove the generated mask related layers from the canvas and "layers" panel
|
||||
|
||||
|
|
@ -1568,8 +1478,6 @@ module.exports = {
|
|||
snapshot_layerExe,
|
||||
fillAndGroupExe,
|
||||
fastSnapshot,
|
||||
setInitImage,
|
||||
setInitImageMask,
|
||||
|
||||
layerToFileName,
|
||||
layerNameToFileName,
|
||||
|
|
|
|||
133
sdapi_py_re.js
133
sdapi_py_re.js
|
|
@ -13,42 +13,6 @@ const {
|
|||
const api = require('./utility/api')
|
||||
//javascript plugin can't read images from local directory so we send a request to local server to read the image file and send it back to plugin as image string base64
|
||||
|
||||
async function getInitImage(init_image_name) {
|
||||
console.log('getInitImage(): get Init Image from the server :')
|
||||
const payload = {
|
||||
init_image_name: init_image_name,
|
||||
}
|
||||
|
||||
// const full_url = 'http://127.0.0.1:8000/getInitImage/'
|
||||
// console.log(full_url)
|
||||
// console.log('getInitImage payload:', payload)
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// // "body": payload
|
||||
// })
|
||||
|
||||
// let json = await request.json()
|
||||
|
||||
// console.log('json:')
|
||||
// console.dir(json)
|
||||
// base64data = json.init_image_str
|
||||
// image_src = `data:image/png;base64, ${base64data}`
|
||||
console.warn('this function is deprecated!')
|
||||
const image_src =
|
||||
'https://im ages.pexels.com/photos/1386604/pexels-photo-1386604.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'
|
||||
return image_src
|
||||
|
||||
// console.log(img.src)
|
||||
|
||||
// let img_blob = await (await fetch(img.src)).blob()
|
||||
// console.log("img_blob:")
|
||||
// console.dir(img_blob)
|
||||
}
|
||||
//REFACTOR: move this function to io.js
|
||||
async function requestSavePng(base64_image, image_name) {
|
||||
try {
|
||||
|
|
@ -68,20 +32,6 @@ async function requestTxt2Img(payload) {
|
|||
try {
|
||||
console.log('requestTxt2Img(): about to send a fetch request')
|
||||
|
||||
// const full_url = 'http://127.0.0.1:8000/txt2img/'
|
||||
// console.log(full_url)
|
||||
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// // "body": payload
|
||||
// })
|
||||
|
||||
// let json = await request.json()
|
||||
let json = await py_re.txt2ImgRequest(payload)
|
||||
console.log('requestTxt2Img json:', json)
|
||||
|
||||
|
|
@ -95,20 +45,6 @@ async function requestTxt2Img(payload) {
|
|||
async function requestImg2Img(payload) {
|
||||
console.log('requestImg2Img(): about to send a fetch request')
|
||||
try {
|
||||
// const full_url = 'http://127.0.0.1:8000/img2img/'
|
||||
// console.log(full_url)
|
||||
// console.log('requestImg2Img payload is: ', payload)
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// // "body": payload
|
||||
// })
|
||||
|
||||
// let json = await request.json()
|
||||
let json = await py_re.img2ImgRequest(g_sd_url, payload)
|
||||
console.log('requestImg2Img json:')
|
||||
console.dir(json)
|
||||
|
|
@ -169,7 +105,6 @@ async function requestGetSamplers() {
|
|||
|
||||
async function requestSwapModel(model_title) {
|
||||
console.log('requestSwapModel: ')
|
||||
// const full_url = 'http://127.0.0.1:8000/swapModel'
|
||||
|
||||
const full_url = `${g_sd_url}/sdapi/v1/options`
|
||||
payload = {
|
||||
|
|
@ -182,7 +117,6 @@ async function requestSwapModel(model_title) {
|
|||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
// "body": payload
|
||||
})
|
||||
|
||||
let json = await request.json()
|
||||
|
|
@ -219,23 +153,9 @@ async function requestInterrupt() {
|
|||
}
|
||||
|
||||
async function getVersionRequest() {
|
||||
// version = "v0.0.0"
|
||||
console.log('requestGetSamplers: ')
|
||||
const current_version = g_version
|
||||
// try {
|
||||
// const full_url = 'http://127.0.0.1:8000/version'
|
||||
// let request = await fetch(full_url)
|
||||
// let json = await request.json()
|
||||
// console.log('version json:', json)
|
||||
// version = json['version']
|
||||
|
||||
// return version
|
||||
// } catch (e) {
|
||||
// console.warn(e)
|
||||
// version = 'v0.0.0'
|
||||
|
||||
// return version
|
||||
// }
|
||||
return current_version
|
||||
}
|
||||
|
||||
|
|
@ -278,21 +198,6 @@ async function loadHistory(uniqueDocumentId) {
|
|||
uniqueDocumentId: uniqueDocumentId,
|
||||
}
|
||||
json = await py_re.loadHistory(payload)
|
||||
// const full_url = 'http://127.0.0.1:8000/history/load'
|
||||
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// })
|
||||
|
||||
// json = await request.json()
|
||||
// console.log('loadHistory:', json)
|
||||
|
||||
// console.log('loadPromptShortcut: request: ',request)
|
||||
} catch (e) {
|
||||
console.warn(e)
|
||||
}
|
||||
|
|
@ -300,23 +205,8 @@ async function loadHistory(uniqueDocumentId) {
|
|||
return [json['image_paths'], json['metadata_jsons'], json['base64_images']]
|
||||
}
|
||||
async function loadPromptShortcut() {
|
||||
// console.log('loadPromptShortcut:')
|
||||
let prompt_shortcut_json = {}
|
||||
try {
|
||||
// payload = {}
|
||||
|
||||
// const full_url = 'http://127.0.0.1:8000/prompt_shortcut/load'
|
||||
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// })
|
||||
|
||||
// json = await request.json()
|
||||
prompt_shortcut_json = await py_re.loadPromptShortcut(
|
||||
'prompt_shortcut.json'
|
||||
)
|
||||
|
|
@ -331,23 +221,8 @@ async function loadPromptShortcut() {
|
|||
}
|
||||
|
||||
async function savePromptShortcut(prompt_shortcut) {
|
||||
// console.log('loadPromptShortcut:')
|
||||
let json = prompt_shortcut
|
||||
try {
|
||||
// payload = { prompt_shortcut: prompt_shortcut }
|
||||
|
||||
// const full_url = 'http://127.0.0.1:8000/prompt_shortcut/save'
|
||||
|
||||
// let request = await fetch(full_url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// Accept: 'application/json',
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(payload),
|
||||
// })
|
||||
|
||||
// json = await request.json()
|
||||
await py_re.savePromptShortcut(json, 'prompt_shortcut.json')
|
||||
console.log('savePromptShortcut:', json)
|
||||
// console.log('loadPromptShortcut: request: ',request)
|
||||
|
|
@ -588,7 +463,7 @@ async function requestControlNetTxt2Img(plugin_settings) {
|
|||
|
||||
// const full_url = `${g_sd_url}/controlnet/txt2img`
|
||||
const full_url = `${g_sd_url}/sdapi/v1/txt2img`
|
||||
// debugger
|
||||
|
||||
const control_net_settings = mapPluginSettingsToControlNet(plugin_settings)
|
||||
let control_networks = []
|
||||
// let active_control_networks = 0
|
||||
|
|
@ -598,7 +473,7 @@ async function requestControlNetTxt2Img(plugin_settings) {
|
|||
continue
|
||||
}
|
||||
control_networks[index] = true
|
||||
// debugger
|
||||
|
||||
if (!control_net_settings['controlnet_units'][index]['input_image']) {
|
||||
app.showAlert('you need to add a valid ControlNet input image')
|
||||
throw 'you need to add a valid ControlNet input image'
|
||||
|
|
@ -670,9 +545,7 @@ async function requestControlNetTxt2Img(plugin_settings) {
|
|||
//REFACTOR: reuse the same code for (requestControlNetTxt2Img,requestControlNetImg2Img)
|
||||
async function requestControlNetImg2Img(plugin_settings) {
|
||||
console.log('requestControlNetImg2Img: ')
|
||||
// const full_url = 'http://127.0.0.1:8000/swapModel'
|
||||
|
||||
// const full_url = `${g_sd_url}/controlnet/img2img`
|
||||
const full_url = `${g_sd_url}/sdapi/v1/img2img`
|
||||
const control_net_settings = mapPluginSettingsToControlNet(plugin_settings)
|
||||
|
||||
|
|
@ -790,7 +663,7 @@ async function requestLoraModels() {
|
|||
module.exports = {
|
||||
requestTxt2Img,
|
||||
requestImg2Img,
|
||||
getInitImage,
|
||||
|
||||
requestProgress,
|
||||
requestGetModels,
|
||||
requestSwapModel,
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,7 @@ function selectMenuItemByElement(menu_element, item) {
|
|||
const option = Array.from(menu_element.options).filter(
|
||||
(element) => element.value === item
|
||||
)[0]
|
||||
// debugger
|
||||
|
||||
option.selected = true
|
||||
// option.dispatchEvent(new Event('click'))
|
||||
// option.click()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const psapi = require('../psapi')
|
||||
// const sdapi = require('../sdapi_py_re')
|
||||
|
||||
const layer_util = require('../utility/layer')
|
||||
const general = require('./general')
|
||||
const Jimp = require('../jimp/browser/lib/jimp.min')
|
||||
|
|
@ -392,7 +392,7 @@ class IO {
|
|||
//send the base64 to the server to save the file in the desired directory
|
||||
// await sdapi.requestSavePng(base64_image, image_name)
|
||||
// await saveFileInSubFolder(base64_image, document_name, image_name)
|
||||
// debugger
|
||||
|
||||
const { requestSavePng } = require('../sdapi_py_re')
|
||||
await requestSavePng(base64_image, image_name)
|
||||
return base64_image
|
||||
|
|
@ -776,7 +776,6 @@ class IOJson {
|
|||
|
||||
static async saveSettingsToFile(settings_json, settings_file_name) {
|
||||
await executeAsModal(async () => {
|
||||
// debugger
|
||||
const folder_entry = await IOFolder.getSettingsFolder('Settings')
|
||||
await this.saveJsonToFile(
|
||||
settings_json,
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ function getPresetType() {
|
|||
|
||||
document.getElementById('btnNewPreset').addEventListener('click', () => {
|
||||
// const g_ui_settings_object = getUISettingsObject()
|
||||
// debugger
|
||||
|
||||
const preset_type = getPresetType()
|
||||
const preset_settings = getPresetSettings(preset_type)
|
||||
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@ async function txt2ImgRequest(payload) {
|
|||
function getExtensionUrl() {
|
||||
const extension_type = settings_tab.getExtensionType()
|
||||
let extension_url
|
||||
|
||||
if (extension_type === 'auto1111_extension') {
|
||||
extension_url = `${g_sd_url}/sdapi/auto-photoshop-sd`
|
||||
} else if (extension_type === 'proxy_server') {
|
||||
|
|
@ -240,7 +241,7 @@ async function openUrlRequest(url) {
|
|||
const payload = {
|
||||
url: url,
|
||||
}
|
||||
// const full_url = 'http://127.0.0.1:8000/mask/expansion/'
|
||||
|
||||
const extension_url = getExtensionUrl()
|
||||
const full_url = `${extension_url}/open/url/`
|
||||
let request = await fetch(full_url, {
|
||||
|
|
@ -270,7 +271,7 @@ async function maskExpansionRequest(original_mask, mask_expansion_value) {
|
|||
mask: original_mask,
|
||||
mask_expansion: mask_expansion_value,
|
||||
}
|
||||
// const full_url = 'http://127.0.0.1:8000/mask/expansion/'
|
||||
|
||||
const extension_url = getExtensionUrl()
|
||||
const full_url = `${extension_url}/mask/expansion/`
|
||||
let request = await fetch(full_url, {
|
||||
|
|
|
|||
|
|
@ -238,8 +238,6 @@ async function requestControlNetDetectMap(
|
|||
}
|
||||
const full_url = `${g_sd_url}/controlnet/detect`
|
||||
|
||||
// debugger
|
||||
|
||||
const response_data = await api.requestPost(full_url, payload)
|
||||
|
||||
// update the mask preview with the new detectMap
|
||||
|
|
@ -341,7 +339,7 @@ function changeModule(_module, index) {
|
|||
|
||||
// threshold_a_element.min = prams.
|
||||
// threshold_a_element.max =
|
||||
// debugger
|
||||
|
||||
if (model_free)
|
||||
controlnetElement(
|
||||
index,
|
||||
|
|
@ -397,7 +395,6 @@ function changeModule(_module, index) {
|
|||
}
|
||||
async function populatePreprocessorMenu() {
|
||||
try {
|
||||
// debugger
|
||||
const modules = await requestControlNetModuleList()
|
||||
for (let index = 0; index < g_controlnet_max_models; index++) {
|
||||
const menu_element = controlnetElement(
|
||||
|
|
@ -570,7 +567,7 @@ function setEnable(index) {
|
|||
}
|
||||
function getSelectedModule(index = 0) {
|
||||
const menu_element = controlnetElement(index, '.mModulesMenuControlNet_')
|
||||
// debugger
|
||||
|
||||
const module_name =
|
||||
html_manip.getSelectedMenuItemTextContentByElement(menu_element)
|
||||
|
||||
|
|
@ -661,7 +658,6 @@ function mapPluginSettingsToControlNet(plugin_settings) {
|
|||
const ps = plugin_settings // for shortness
|
||||
let controlnet_units = []
|
||||
|
||||
// debugger
|
||||
let active_index = 0
|
||||
for (let index = 0; index < g_controlnet_max_models; index++) {
|
||||
const preprocessor_name = getSelectedModule(index)
|
||||
|
|
@ -782,7 +778,6 @@ function initControlNetUnitsEventListeners(controlnet_max_models) {
|
|||
index,
|
||||
'.slControlNetGuidanceStrengthStart_'
|
||||
).addEventListener('input', (evt) => {
|
||||
// debugger
|
||||
const sd_value = general.mapRange(evt.target.value, 0, 100, 0, 1) // convert slider value to SD ready value
|
||||
controlnetElement(
|
||||
index,
|
||||
|
|
@ -794,7 +789,6 @@ function initControlNetUnitsEventListeners(controlnet_max_models) {
|
|||
index,
|
||||
'.slControlNetGuidanceStrengthEnd_'
|
||||
).addEventListener('input', (evt) => {
|
||||
// debugger
|
||||
const sd_value = general.mapRange(evt.target.value, 0, 100, 0, 1) // convert slider value to SD ready value
|
||||
controlnetElement(
|
||||
index,
|
||||
|
|
@ -805,7 +799,6 @@ function initControlNetUnitsEventListeners(controlnet_max_models) {
|
|||
document
|
||||
.querySelector(`#controlnet_settings_${index} .slControlNetWeight_`)
|
||||
.addEventListener('input', (evt) => {
|
||||
// debugger
|
||||
const sd_value = general.mapRange(
|
||||
evt.target.value,
|
||||
0,
|
||||
|
|
@ -821,7 +814,7 @@ function initControlNetUnitsEventListeners(controlnet_max_models) {
|
|||
// controlnetElement(index, '.slControlNetProcessorRes_').addEventListener(
|
||||
// 'input',
|
||||
// (evt) => {
|
||||
// // debugger
|
||||
//
|
||||
// const sd_value = general.mapRange(
|
||||
// evt.target.value,
|
||||
// 64,
|
||||
|
|
@ -883,7 +876,6 @@ function initControlNetUnitsEventListeners(controlnet_max_models) {
|
|||
const selectionInfo =
|
||||
await selection.Selection.getSelectionInfoExe()
|
||||
if (selectionInfo) {
|
||||
// debugger
|
||||
const base64_image =
|
||||
await g_generation_session.setControlNetImageHelper()
|
||||
await g_generation_session.setControlNetImage(
|
||||
|
|
@ -1011,7 +1003,6 @@ function initPreviewElement(index) {
|
|||
mask_parent_element.appendChild(thumbnail_container)
|
||||
|
||||
async function toCanvas(index) {
|
||||
// debugger
|
||||
if (
|
||||
g_generation_session.control_net_preview_selection_info &&
|
||||
g_generation_session.controlNetMask[index]
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ function getImageCfgScaleSDValue() {
|
|||
function setImageCfgScaleSDValue(sd_value) {
|
||||
const slider_id = 'slImageCfgScale'
|
||||
const label_id = 'lImageCfgScale'
|
||||
// debugger
|
||||
|
||||
html_manip.setSliderSdValue(slider_id, label_id, sd_value, 0, 30, 0, 3)
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ function ctrlBackspaceDelete(text) {
|
|||
}
|
||||
|
||||
// document.getElementById('taPrompt').addEventListener('input', (event) => {
|
||||
// // debugger
|
||||
//
|
||||
// const value = event.target.value
|
||||
// console.log('value: ', value)
|
||||
// let index = value.indexOf(String.fromCharCode(127))
|
||||
|
|
|
|||
Loading…
Reference in New Issue