mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-04-28 13:29:17 +02:00
Merge branch 'beta' of github.com:cmdr2/stable-diffusion-ui into beta
This commit is contained in:
commit
477a4fc0e3
@ -230,6 +230,20 @@ const TASK_MAPPING = {
|
|||||||
readUI: () => vaeModelField.value,
|
readUI: () => vaeModelField.value,
|
||||||
parse: (val) => val
|
parse: (val) => val
|
||||||
},
|
},
|
||||||
|
use_lora_model: { name: 'LoRA model',
|
||||||
|
setUI: (use_lora_model) => {
|
||||||
|
const oldVal = loraModelField.value
|
||||||
|
use_lora_model = (use_lora_model === undefined || use_lora_model === null || use_lora_model === 'None' ? '' : use_lora_model)
|
||||||
|
|
||||||
|
if (use_lora_model !== '') {
|
||||||
|
use_lora_model = getModelPath(use_lora_model, ['.ckpt', '.safetensors'])
|
||||||
|
use_lora_model = use_lora_model !== '' ? use_lora_model : oldVal
|
||||||
|
}
|
||||||
|
loraModelField.value = use_lora_model
|
||||||
|
},
|
||||||
|
readUI: () => loraModelField.value,
|
||||||
|
parse: (val) => val
|
||||||
|
},
|
||||||
use_hypernetwork_model: { name: 'Hypernetwork model',
|
use_hypernetwork_model: { name: 'Hypernetwork model',
|
||||||
setUI: (use_hypernetwork_model) => {
|
setUI: (use_hypernetwork_model) => {
|
||||||
const oldVal = hypernetworkModelField.value
|
const oldVal = hypernetworkModelField.value
|
||||||
|
@ -171,6 +171,7 @@ const IMAGE_EDITOR_ACTIONS = [
|
|||||||
icon: "fa-solid fa-xmark",
|
icon: "fa-solid fa-xmark",
|
||||||
handler: (editor) => {
|
handler: (editor) => {
|
||||||
editor.ctx_current.clearRect(0, 0, editor.width, editor.height)
|
editor.ctx_current.clearRect(0, 0, editor.width, editor.height)
|
||||||
|
imageEditor.setImage(null, editor.width, editor.height) // properly reset the drawing canvas
|
||||||
},
|
},
|
||||||
trackHistory: true
|
trackHistory: true
|
||||||
},
|
},
|
||||||
|
@ -129,7 +129,10 @@ function createModifierGroup(modifierGroup, initiallyExpanded, removeBy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function trimModifiers(tag) {
|
function trimModifiers(tag) {
|
||||||
return tag.replace(/^\(+|\)+$/g, '').replace(/^\[+|\]+$/g, '')
|
// Remove trailing '-' and/or '+'
|
||||||
|
tag = tag.replace(/[-+]+$/, '');
|
||||||
|
// Remove parentheses at beginning and end
|
||||||
|
return tag.replace(/^[(]+|[\s)]+$/g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadModifiers() {
|
async function loadModifiers() {
|
||||||
|
@ -1192,31 +1192,10 @@ function createFileName(prompt, seed, steps, guidance, outputFormat) {
|
|||||||
|
|
||||||
// Most important information is the prompt
|
// Most important information is the prompt
|
||||||
let underscoreName = prompt.replace(/[^a-zA-Z0-9]/g, '_')
|
let underscoreName = prompt.replace(/[^a-zA-Z0-9]/g, '_')
|
||||||
underscoreName = underscoreName.substring(0, 100)
|
underscoreName = underscoreName.substring(0, 70)
|
||||||
//const steps = numInferenceStepsField.value
|
|
||||||
//const guidance = guidanceScaleField.value
|
|
||||||
|
|
||||||
// name and the top level metadata
|
// name and the top level metadata
|
||||||
let fileName = `${underscoreName}_Seed-${seed}_Steps-${steps}_Guidance-${guidance}`
|
let fileName = `${underscoreName}_S${seed}_St${steps}_G${guidance}.${outputFormat}`
|
||||||
|
|
||||||
// add the tags
|
|
||||||
// let tags = []
|
|
||||||
// let tagString = ''
|
|
||||||
// document.querySelectorAll(modifyTagsSelector).forEach(function(tag) {
|
|
||||||
// tags.push(tag.innerHTML)
|
|
||||||
// })
|
|
||||||
|
|
||||||
// join the tags with a pipe
|
|
||||||
// if (activeTags.length > 0) {
|
|
||||||
// tagString = '_Tags-'
|
|
||||||
// tagString += tags.join('|')
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // append empty or populated tags
|
|
||||||
// fileName += `${tagString}`
|
|
||||||
|
|
||||||
// add the file extension
|
|
||||||
fileName += '.' + outputFormat
|
|
||||||
|
|
||||||
return fileName
|
return fileName
|
||||||
}
|
}
|
||||||
@ -1296,7 +1275,7 @@ function downloadAllImages() {
|
|||||||
|
|
||||||
document.querySelectorAll(".imageTaskContainer").forEach(container => {
|
document.querySelectorAll(".imageTaskContainer").forEach(container => {
|
||||||
if (optTree) {
|
if (optTree) {
|
||||||
let name = ++i + '-' + container.querySelector('.preview-prompt').textContent.replace(/[^a-zA-Z0-9]/g, '_')
|
let name = ++i + '-' + container.querySelector('.preview-prompt').textContent.replace(/[^a-zA-Z0-9]/g, '_').substring(0,25)
|
||||||
folder = zip.folder(name)
|
folder = zip.folder(name)
|
||||||
}
|
}
|
||||||
container.querySelectorAll(".imgContainer img").forEach(img => {
|
container.querySelectorAll(".imgContainer img").forEach(img => {
|
||||||
@ -1325,9 +1304,9 @@ function downloadAllImages() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
if (optZIP) {
|
if (optZIP) {
|
||||||
let now = new Date()
|
let now = Date.now().toString(36).toUpperCase()
|
||||||
zip.generateAsync({type:"blob"}).then(function (blob) {
|
zip.generateAsync({type:"blob"}).then(function (blob) {
|
||||||
saveAs(blob, `EasyDiffusion-Images-${now.toISOString()}.zip`);
|
saveAs(blob, `EasyDiffusion-Images-${now}.zip`);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
(function () { "use strict"
|
(function () {
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
const MAX_WEIGHT = 5
|
||||||
|
|
||||||
if (typeof editorModifierTagsList !== 'object') {
|
if (typeof editorModifierTagsList !== 'object') {
|
||||||
console.error('editorModifierTagsList missing...')
|
console.error('editorModifierTagsList missing...')
|
||||||
return
|
return
|
||||||
@ -34,34 +38,42 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (s.charAt(0) !== '(' && s.charAt(s.length - 1) !== ')' && s.trim().includes(' ')) {
|
||||||
|
s = '(' + s + ')'
|
||||||
|
t = '(' + t + ')'
|
||||||
|
}
|
||||||
if (delta < 0) {
|
if (delta < 0) {
|
||||||
// wheel scrolling up
|
// wheel scrolling up
|
||||||
if (s.substring(0, 1) == '[' && s.substring(s.length-1) == ']') {
|
if (s.substring(s.length - 1) == '-') {
|
||||||
s = s.substring(1, s.length - 1)
|
s = s.substring(0, s.length - 1)
|
||||||
t = t.substring(1, t.length - 1)
|
t = t.substring(0, t.length - 1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.substring(0, 10) !== '('.repeat(10) && s.substring(s.length-10) !== ')'.repeat(10)) {
|
if (s.substring(s.length - MAX_WEIGHT) !== '+'.repeat(MAX_WEIGHT)) {
|
||||||
s = '(' + s + ')'
|
s = s + '+'
|
||||||
t = '(' + t + ')'
|
t = t + '+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// wheel scrolling down
|
// wheel scrolling down
|
||||||
if (s.substring(0, 1) == '(' && s.substring(s.length-1) == ')') {
|
if (s.substring(s.length - 1) == '+') {
|
||||||
s = s.substring(1, s.length - 1)
|
s = s.substring(0, s.length - 1)
|
||||||
t = t.substring(1, t.length - 1)
|
t = t.substring(0, t.length - 1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.substring(0, 10) !== '['.repeat(10) && s.substring(s.length-10) !== ']'.repeat(10)) {
|
if (s.substring(s.length - MAX_WEIGHT) !== '-'.repeat(MAX_WEIGHT)) {
|
||||||
s = '[' + s + ']'
|
s = s + '-'
|
||||||
t = '[' + t + ']'
|
t = t + '-'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (s.charAt(0) === '(' && s.charAt(s.length - 1) === ')') {
|
||||||
|
s = s.substring(1, s.length - 1)
|
||||||
|
t = t.substring(1, t.length - 1)
|
||||||
|
}
|
||||||
i.parentElement.getElementsByClassName('modifier-card-label')[0].getElementsByTagName("p")[0].innerText = s
|
i.parentElement.getElementsByClassName('modifier-card-label')[0].getElementsByTagName("p")[0].innerText = s
|
||||||
// update activeTags
|
// update activeTags
|
||||||
for (let it = 0; it < overlays.length; it++) {
|
for (let it = 0; it < overlays.length; it++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user