mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-04-16 15:38:37 +02:00
formatting
This commit is contained in:
parent
fe6991c703
commit
0139111d49
@ -1346,7 +1346,8 @@ function getPromptsNumber(prompts) {
|
|||||||
|
|
||||||
let promptsToMake = []
|
let promptsToMake = []
|
||||||
let numberOfPrompts = 0
|
let numberOfPrompts = 0
|
||||||
if (prompts.trim() !== "") { // this needs to stay sort of the same, as the prompts have to be passed through to the other functions
|
if (prompts.trim() !== "") {
|
||||||
|
// this needs to stay sort of the same, as the prompts have to be passed through to the other functions
|
||||||
prompts = prompts.split("\n")
|
prompts = prompts.split("\n")
|
||||||
prompts = prompts.map((prompt) => prompt.trim())
|
prompts = prompts.map((prompt) => prompt.trim())
|
||||||
prompts = prompts.filter((prompt) => prompt !== "")
|
prompts = prompts.filter((prompt) => prompt !== "")
|
||||||
@ -1354,7 +1355,11 @@ function getPromptsNumber(prompts) {
|
|||||||
// estimate number of prompts
|
// estimate number of prompts
|
||||||
let estimatedNumberOfPrompts = 0
|
let estimatedNumberOfPrompts = 0
|
||||||
prompts.forEach((prompt) => {
|
prompts.forEach((prompt) => {
|
||||||
estimatedNumberOfPrompts += (prompt.match(/{[^}]*}/g) || []).map((e) => (e.match(/,/g) || []).length + 1).reduce( (p,a) => p*a, 1) * (2**(prompt.match(/\|/g) || []).length)
|
estimatedNumberOfPrompts +=
|
||||||
|
(prompt.match(/{[^}]*}/g) || [])
|
||||||
|
.map((e) => (e.match(/,/g) || []).length + 1)
|
||||||
|
.reduce((p, a) => p * a, 1) *
|
||||||
|
2 ** (prompt.match(/\|/g) || []).length
|
||||||
})
|
})
|
||||||
|
|
||||||
if (estimatedNumberOfPrompts >= 10000) {
|
if (estimatedNumberOfPrompts >= 10000) {
|
||||||
@ -1394,7 +1399,8 @@ function applySetOperator(prompts) {
|
|||||||
return promptsToMake
|
return promptsToMake
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyPermuteOperator(prompts) { // prompts is array of input, trimmed, filtered and split by \n
|
function applyPermuteOperator(prompts) {
|
||||||
|
// prompts is array of input, trimmed, filtered and split by \n
|
||||||
let promptsToMake = []
|
let promptsToMake = []
|
||||||
prompts.forEach((prompt) => {
|
prompts.forEach((prompt) => {
|
||||||
let promptMatrix = prompt.split("|")
|
let promptMatrix = prompt.split("|")
|
||||||
@ -1414,7 +1420,8 @@ function applyPermuteOperator(prompts) { // prompts is array of input, trimmed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns how many prompts would have to be made with the given prompts
|
// returns how many prompts would have to be made with the given prompts
|
||||||
function applyPermuteOperatorNumber(prompts) { // prompts is array of input, trimmed, filtered and split by \n
|
function applyPermuteOperatorNumber(prompts) {
|
||||||
|
// prompts is array of input, trimmed, filtered and split by \n
|
||||||
let numberOfPrompts = 0
|
let numberOfPrompts = 0
|
||||||
prompts.forEach((prompt) => {
|
prompts.forEach((prompt) => {
|
||||||
let promptCounter = 1
|
let promptCounter = 1
|
||||||
@ -1510,8 +1517,12 @@ clearAllPreviewsBtn.addEventListener("click", (e) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/* Download images popup */
|
/* Download images popup */
|
||||||
showDownloadDialogBtn.addEventListener("click", (e) => { saveAllImagesDialog.showModal() })
|
showDownloadDialogBtn.addEventListener("click", (e) => {
|
||||||
saveAllImagesCloseBtn.addEventListener("click", (e) => { saveAllImagesDialog.close() })
|
saveAllImagesDialog.showModal()
|
||||||
|
})
|
||||||
|
saveAllImagesCloseBtn.addEventListener("click", (e) => {
|
||||||
|
saveAllImagesDialog.close()
|
||||||
|
})
|
||||||
modalDialogCloseOnBackdropClick(saveAllImagesDialog)
|
modalDialogCloseOnBackdropClick(saveAllImagesDialog)
|
||||||
makeDialogDraggable(saveAllImagesDialog)
|
makeDialogDraggable(saveAllImagesDialog)
|
||||||
|
|
||||||
@ -1629,15 +1640,11 @@ function renameMakeImageButton() {
|
|||||||
imageLabel = totalImages + " Images"
|
imageLabel = totalImages + " Images"
|
||||||
}
|
}
|
||||||
if (SD.activeTasks.size == 0) {
|
if (SD.activeTasks.size == 0) {
|
||||||
if (totalImages >= 10000)
|
if (totalImages >= 10000) makeImageBtn.innerText = "Make 10000+ images"
|
||||||
makeImageBtn.innerText = "Make 10000+ images"
|
else makeImageBtn.innerText = "Make " + imageLabel
|
||||||
else
|
|
||||||
makeImageBtn.innerText = "Make " + imageLabel
|
|
||||||
} else {
|
} else {
|
||||||
if (totalImages >= 10000)
|
if (totalImages >= 10000) makeImageBtn.innerText = "Enqueue 10000+ images"
|
||||||
makeImageBtn.innerText = "Enqueue 10000+ images"
|
else makeImageBtn.innerText = "Enqueue Next " + imageLabel
|
||||||
else
|
|
||||||
makeImageBtn.innerText = "Enqueue Next " + imageLabel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numOutputsTotalField.addEventListener("change", renameMakeImageButton)
|
numOutputsTotalField.addEventListener("change", renameMakeImageButton)
|
||||||
@ -2073,9 +2080,8 @@ function resumeClient() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function splashScreen(force = false) {
|
function splashScreen(force = false) {
|
||||||
const splashVersion = splashScreenPopup.dataset['version']
|
const splashVersion = splashScreenPopup.dataset["version"]
|
||||||
const lastSplash = localStorage.getItem("lastSplashScreenVersion") || 0
|
const lastSplash = localStorage.getItem("lastSplashScreenVersion") || 0
|
||||||
if (testDiffusers.checked) {
|
if (testDiffusers.checked) {
|
||||||
if (force || lastSplash < splashVersion) {
|
if (force || lastSplash < splashVersion) {
|
||||||
@ -2085,8 +2091,9 @@ function splashScreen(force = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById("logo_img").addEventListener("click", (e) => {
|
||||||
document.getElementById("logo_img").addEventListener("click", (e) => { splashScreen(true) })
|
splashScreen(true)
|
||||||
|
})
|
||||||
|
|
||||||
promptField.addEventListener("input", debounce(renameMakeImageButton, 1000))
|
promptField.addEventListener("input", debounce(renameMakeImageButton, 1000))
|
||||||
|
|
||||||
@ -2145,8 +2152,8 @@ function updateEmbeddingsList(filter="") {
|
|||||||
let toplevel = ""
|
let toplevel = ""
|
||||||
let folders = ""
|
let folders = ""
|
||||||
|
|
||||||
model?.forEach( m => {
|
model?.forEach((m) => {
|
||||||
if (typeof(m) == "string") {
|
if (typeof m == "string") {
|
||||||
if (m.toLowerCase().search(filter) != -1) {
|
if (m.toLowerCase().search(filter) != -1) {
|
||||||
toplevel += `<button data-embedding="${m}">${m}</button> `
|
toplevel += `<button data-embedding="${m}">${m}</button> `
|
||||||
}
|
}
|
||||||
@ -2197,7 +2204,9 @@ function updateEmbeddingsList(filter="") {
|
|||||||
// END of remove block
|
// END of remove block
|
||||||
|
|
||||||
embeddingsList.innerHTML = warning + html(modelsOptions.embeddings, "", filter)
|
embeddingsList.innerHTML = warning + html(modelsOptions.embeddings, "", filter)
|
||||||
embeddingsList.querySelectorAll("button").forEach( (b) => { b.addEventListener("click", onButtonClick)})
|
embeddingsList.querySelectorAll("button").forEach((b) => {
|
||||||
|
b.addEventListener("click", onButtonClick)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
embeddingsButton.addEventListener("click", () => {
|
embeddingsButton.addEventListener("click", () => {
|
||||||
@ -2215,7 +2224,6 @@ embeddingsSearchBox.addEventListener("input", (e) => {
|
|||||||
modalDialogCloseOnBackdropClick(embeddingsDialog)
|
modalDialogCloseOnBackdropClick(embeddingsDialog)
|
||||||
makeDialogDraggable(embeddingsDialog)
|
makeDialogDraggable(embeddingsDialog)
|
||||||
|
|
||||||
|
|
||||||
if (testDiffusers.checked) {
|
if (testDiffusers.checked) {
|
||||||
document.getElementById("embeddings-container").classList.remove("displayNone")
|
document.getElementById("embeddings-container").classList.remove("displayNone")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user