request list of lora models names and convert them to prompts
parent
e88b23baed
commit
d2093bdf1d
|
|
@ -4,7 +4,9 @@ const { getExtensionType } = require('./utility/html_manip')
|
|||
const py_re = require('./utility/sdapi/python_replacement')
|
||||
const Enum = require('./enum')
|
||||
const control_net = require('./utility/tab/control_net')
|
||||
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 = {
|
||||
|
|
@ -755,6 +757,12 @@ async function isWebuiRunning() {
|
|||
}
|
||||
return true
|
||||
}
|
||||
async function requestLoraModels() {
|
||||
const extension_url = py_re.getExtensionUrl()
|
||||
const full_url = `${extension_url}/lora/list`
|
||||
const lora_models = await api.requestGet(full_url)
|
||||
return lora_models
|
||||
}
|
||||
module.exports = {
|
||||
requestTxt2Img,
|
||||
requestImg2Img,
|
||||
|
|
@ -782,4 +790,5 @@ module.exports = {
|
|||
requestControlNetTxt2Img,
|
||||
requestControlNetImg2Img,
|
||||
isWebuiRunning,
|
||||
requestLoraModels,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,9 @@ function updateHrScaleFromToLabel() {
|
|||
'lHrScaleFromTo'
|
||||
).textContent = `${width}x${height} -> ${hr_width}x${hr_height}`
|
||||
}
|
||||
function getLoraModelPrompt(lora_model_name) {
|
||||
return `<lora:${lora_model_name}:1>`
|
||||
}
|
||||
function initInitMaskElement() {
|
||||
//make init mask image use the thumbnail class with buttons
|
||||
const mask_image_html = html_manip.getInitImageMaskElement()
|
||||
|
|
@ -229,4 +232,5 @@ module.exports = {
|
|||
viewDrawnMask,
|
||||
clipInterrogate,
|
||||
getHrScaleSliderSDValue,
|
||||
getLoraModelPrompt,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue