Prevent empty fields in make image request

Prevent render jobs to fail with HTTP 422 due to empty fields in the image settings.
https://discord.com/channels/1014774730907209781/1043481789706031215/1043481789706031215
https://discord.com/channels/1014774730907209781/1014774732018683927/1042768986871443516

minor change, no CHANGE.md entry
This commit is contained in:
JeLuF 2022-11-19 21:00:41 +01:00
parent a3463274ee
commit ae409dd0ec

View File

@ -823,8 +823,17 @@ function getCurrentUserRequest() {
function makeImage() {
if (!isServerAvailable()) {
alert('The server is not available.')
return
}
} else if (!randomSeedField.checked && seedField.value == '') {
alert('The "Seed" field must not be empty.')
} else if (numOutputsTotalField.value == '') {
alert('The "Number of Images" field must not be empty.')
} else if (numOutputsParallelField.value == '') {
alert('The "Number of parallel Images" field must not be empty.')
} else if (numInferenceStepsField.value == '') {
alert('The "Inference Steps" field must not be empty.')
} else if (guidanceScaleField.value == '') {
alert('The Guidance Scale field must not be empty.')
} else {
const taskTemplate = getCurrentUserRequest()
const newTaskRequests = []
getPrompts().forEach((prompt) => newTaskRequests.push(Object.assign({}, taskTemplate, {
@ -833,6 +842,7 @@ function makeImage() {
newTaskRequests.forEach(createTask)
initialText.style.display = 'none'
}
}
function createTask(task) {