mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-18 11:20:58 +01:00
Fix (typeof stepUpdate !== 'object') not completing the task on stop.
This commit is contained in:
parent
e3184622e8
commit
83e5410945
@ -605,29 +605,29 @@ function onTaskErrorHandler(task, reqBody, instance, reason) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) {
|
function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) {
|
||||||
if (typeof stepUpdate !== 'object') {
|
if (typeof stepUpdate === 'object') {
|
||||||
return
|
if (stepUpdate.status === 'succeeded') {
|
||||||
}
|
showImages(reqBody, stepUpdate, outputContainer, false)
|
||||||
if (stepUpdate.status !== 'succeeded') {
|
|
||||||
const outputMsg = task['outputMsg']
|
|
||||||
let msg = ''
|
|
||||||
if ('detail' in stepUpdate && typeof stepUpdate.detail === 'string' && stepUpdate.detail.length > 0) {
|
|
||||||
msg = stepUpdate.detail
|
|
||||||
if (msg.toLowerCase().includes('out of memory')) {
|
|
||||||
msg += `<br/><br/>
|
|
||||||
<b>Suggestions</b>:
|
|
||||||
<br/>
|
|
||||||
1. If you have set an initial image, please try reducing its dimension to ${MAX_INIT_IMAGE_DIMENSION}x${MAX_INIT_IMAGE_DIMENSION} or smaller.<br/>
|
|
||||||
2. Try disabling the '<em>Turbo mode</em>' under '<em>Advanced Settings</em>'.<br/>
|
|
||||||
3. Try generating a smaller image.<br/>`
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
msg = `Unexpected Read Error:<br/><pre>StepUpdate: ${JSON.stringify(stepUpdate, undefined, 4)}</pre>`
|
task.isProcessing = false
|
||||||
|
const outputMsg = task['outputMsg']
|
||||||
|
let msg = ''
|
||||||
|
if ('detail' in stepUpdate && typeof stepUpdate.detail === 'string' && stepUpdate.detail.length > 0) {
|
||||||
|
msg = stepUpdate.detail
|
||||||
|
if (msg.toLowerCase().includes('out of memory')) {
|
||||||
|
msg += `<br/><br/>
|
||||||
|
<b>Suggestions</b>:
|
||||||
|
<br/>
|
||||||
|
1. If you have set an initial image, please try reducing its dimension to ${MAX_INIT_IMAGE_DIMENSION}x${MAX_INIT_IMAGE_DIMENSION} or smaller.<br/>
|
||||||
|
2. Try disabling the '<em>Turbo mode</em>' under '<em>Advanced Settings</em>'.<br/>
|
||||||
|
3. Try generating a smaller image.<br/>`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
msg = `Unexpected Read Error:<br/><pre>StepUpdate: ${JSON.stringify(stepUpdate, undefined, 4)}</pre>`
|
||||||
|
}
|
||||||
|
logError(msg, stepUpdate, outputMsg)
|
||||||
}
|
}
|
||||||
logError(msg, stepUpdate, outputMsg)
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
showImages(reqBody, stepUpdate, outputContainer, false)
|
|
||||||
if (task.isProcessing && task.batchesDone < task.batchCount) {
|
if (task.isProcessing && task.batchesDone < task.batchCount) {
|
||||||
task['taskStatusLabel'].innerText = "Pending"
|
task['taskStatusLabel'].innerText = "Pending"
|
||||||
task['taskStatusLabel'].classList.add('waitingTaskLabel')
|
task['taskStatusLabel'].classList.add('waitingTaskLabel')
|
||||||
@ -638,8 +638,6 @@ function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatus('request', 'done', 'success')
|
|
||||||
|
|
||||||
task.isProcessing = false
|
task.isProcessing = false
|
||||||
task['stopTask'].innerHTML = '<i class="fa-solid fa-trash-can"></i> Remove'
|
task['stopTask'].innerHTML = '<i class="fa-solid fa-trash-can"></i> Remove'
|
||||||
task['taskStatusLabel'].style.display = 'none'
|
task['taskStatusLabel'].style.display = 'none'
|
||||||
|
Loading…
Reference in New Issue
Block a user