diff --git a/ui/media/js/main.js b/ui/media/js/main.js index d16b8b88..4e407511 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -605,29 +605,29 @@ function onTaskErrorHandler(task, reqBody, instance, reason) { } function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) { - if (typeof stepUpdate !== 'object') { - return - } - 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 += `

- Suggestions: -
- 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.
- 2. Try disabling the 'Turbo mode' under 'Advanced Settings'.
- 3. Try generating a smaller image.
` - } + if (typeof stepUpdate === 'object') { + if (stepUpdate.status === 'succeeded') { + showImages(reqBody, stepUpdate, outputContainer, false) } else { - msg = `Unexpected Read Error:
StepUpdate: ${JSON.stringify(stepUpdate, undefined, 4)}
` + 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 += `

+ Suggestions: +
+ 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.
+ 2. Try disabling the 'Turbo mode' under 'Advanced Settings'.
+ 3. Try generating a smaller image.
` + } + } else { + msg = `Unexpected Read Error:
StepUpdate: ${JSON.stringify(stepUpdate, undefined, 4)}
` + } + logError(msg, stepUpdate, outputMsg) } - logError(msg, stepUpdate, outputMsg) - return false } - showImages(reqBody, stepUpdate, outputContainer, false) if (task.isProcessing && task.batchesDone < task.batchCount) { task['taskStatusLabel'].innerText = "Pending" task['taskStatusLabel'].classList.add('waitingTaskLabel') @@ -638,8 +638,6 @@ function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) { return } - setStatus('request', 'done', 'success') - task.isProcessing = false task['stopTask'].innerHTML = ' Remove' task['taskStatusLabel'].style.display = 'none'