mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-09 07:45:01 +02:00
engine.js (#615)
* New engine.js first draft. * Small fixes... * Bump version for cache... * Improved cancellation code. * Cleaning * Wrong argument used in Task.waitUntil * session_id needs to always match SD.sessionId * Removed passing explicit Session ID from UI. Use SD.sessionID to replace. * Cleaning... Removed a disabled line and a hardcoded value. * Fix return if tasks are still waiting. * Added checkbox to reverse processing order. * Fixed progress not displaying properly. * Renamed reverse label. * Only hide progress bar inside onCompleted. * Thanks to rbertus2000 for helping testing and debugging! * Resolve async promises when used optionally. * when removed var should have used let, not const. * Renamed getTaskErrorHandler to onTaskErrorHandler to better reflect actual implementation. * Switched to the unsafer and less git friendly end of lines comma as requested in review. * Raised SERVER_STATE_VALIDITY_DURATION to 90 seconds to match the changes to Beta. * Added logging. * Added one more hook before those inside the SD engine. * Added selftest.plugin.js as part of core. * Removed a tests that wasn't yet implemented... * Groupped task stopping and abort in single function. * Added optional test for plugins. * Allow prompt text to be selected. * Added comment. * Improved isServerAvailable for better mobile usage and added comments for easier debugging. * Comments... * Normalized EVENT_STATUS_CHANGED to follow the same pattern as the other events. * Disable plugins if editorModifierTagsList is not defined. * Adds a new ServiceContainer to register IOC handlers. * Added expect test for a missing dependency in a ServiceContainer * Moved all event code in it's own sub class for easier reuse. * Removed forgotten unused var... * Allow getPrompts to be reused be plugins. * Renamed EventSource to GenericEventSource to avoid redefining an existing class name. * Added missing time argument to debounce * Added output_quality to engine.js * output_quality need to be an int. * Fixed typo. * Replaced the default euler_a by dpm2 to work with both SD1.# and SD2 * Remove generic completed tasks from plugins on generator complete. * dpm2 starts at step 2, replaced with plms to start at step 1. * Merge error * Merge error * changelog Co-authored-by: Marc-Andre Ferland <madrang@gmail.com>
This commit is contained in:
@ -61,6 +61,13 @@ var PARAMETERS = [
|
||||
icon: "fa-volume-low",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "process_order_toggle",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Process newest jobs first",
|
||||
note: "reverse the normal processing order",
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "ui_open_browser_on_start",
|
||||
type: ParameterType.checkbox,
|
||||
@ -368,73 +375,69 @@ function setHostInfo(hosts) {
|
||||
|
||||
async function getSystemInfo() {
|
||||
try {
|
||||
let res = await fetch('/get/system_info')
|
||||
if (res.status === 200) {
|
||||
res = await res.json()
|
||||
let devices = res['devices']
|
||||
let hosts = res['hosts']
|
||||
const res = await SD.getSystemInfo()
|
||||
let devices = res['devices']
|
||||
|
||||
let allDeviceIds = Object.keys(devices['all']).filter(d => d !== 'cpu')
|
||||
let activeDeviceIds = Object.keys(devices['active']).filter(d => d !== 'cpu')
|
||||
let allDeviceIds = Object.keys(devices['all']).filter(d => d !== 'cpu')
|
||||
let activeDeviceIds = Object.keys(devices['active']).filter(d => d !== 'cpu')
|
||||
|
||||
if (activeDeviceIds.length === 0) {
|
||||
useCPUField.checked = true
|
||||
}
|
||||
|
||||
if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION || useCPUField.checked) {
|
||||
let gpuSettingEntry = getParameterSettingsEntry('use_gpus')
|
||||
gpuSettingEntry.style.display = 'none'
|
||||
let autoPickGPUSettingEntry = getParameterSettingsEntry('auto_pick_gpus')
|
||||
autoPickGPUSettingEntry.style.display = 'none'
|
||||
}
|
||||
|
||||
if (allDeviceIds.length === 0) {
|
||||
useCPUField.checked = true
|
||||
useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory
|
||||
}
|
||||
|
||||
autoPickGPUsField.checked = (devices['config'] === 'auto')
|
||||
|
||||
useGPUsField.innerHTML = ''
|
||||
allDeviceIds.forEach(device => {
|
||||
let deviceName = devices['all'][device]['name']
|
||||
let deviceOption = `<option value="${device}">${deviceName} (${device})</option>`
|
||||
useGPUsField.insertAdjacentHTML('beforeend', deviceOption)
|
||||
})
|
||||
|
||||
if (autoPickGPUsField.checked) {
|
||||
let gpuSettingEntry = getParameterSettingsEntry('use_gpus')
|
||||
gpuSettingEntry.style.display = 'none'
|
||||
} else {
|
||||
$('#use_gpus').val(activeDeviceIds)
|
||||
}
|
||||
|
||||
setDeviceInfo(devices)
|
||||
setHostInfo(hosts)
|
||||
if (activeDeviceIds.length === 0) {
|
||||
useCPUField.checked = true
|
||||
}
|
||||
|
||||
if (allDeviceIds.length < MIN_GPUS_TO_SHOW_SELECTION || useCPUField.checked) {
|
||||
let gpuSettingEntry = getParameterSettingsEntry('use_gpus')
|
||||
gpuSettingEntry.style.display = 'none'
|
||||
let autoPickGPUSettingEntry = getParameterSettingsEntry('auto_pick_gpus')
|
||||
autoPickGPUSettingEntry.style.display = 'none'
|
||||
}
|
||||
|
||||
if (allDeviceIds.length === 0) {
|
||||
useCPUField.checked = true
|
||||
useCPUField.disabled = true // no compatible GPUs, so make the CPU mandatory
|
||||
}
|
||||
|
||||
autoPickGPUsField.checked = (devices['config'] === 'auto')
|
||||
|
||||
useGPUsField.innerHTML = ''
|
||||
allDeviceIds.forEach(device => {
|
||||
let deviceName = devices['all'][device]['name']
|
||||
let deviceOption = `<option value="${device}">${deviceName} (${device})</option>`
|
||||
useGPUsField.insertAdjacentHTML('beforeend', deviceOption)
|
||||
})
|
||||
|
||||
if (autoPickGPUsField.checked) {
|
||||
let gpuSettingEntry = getParameterSettingsEntry('use_gpus')
|
||||
gpuSettingEntry.style.display = 'none'
|
||||
} else {
|
||||
$('#use_gpus').val(activeDeviceIds)
|
||||
}
|
||||
|
||||
setDeviceInfo(devices)
|
||||
setHostInfo(res['hosts'])
|
||||
} catch (e) {
|
||||
console.log('error fetching devices', e)
|
||||
}
|
||||
}
|
||||
|
||||
saveSettingsBtn.addEventListener('click', function() {
|
||||
let updateBranch = (useBetaChannelField.checked ? 'beta' : 'main')
|
||||
|
||||
if (listenPortField.value == '') {
|
||||
alert('The network port field must not be empty.')
|
||||
} else if (listenPortField.value<1 || listenPortField.value>65535) {
|
||||
alert('The network port must be a number from 1 to 65535')
|
||||
} else {
|
||||
changeAppConfig({
|
||||
'render_devices': getCurrentRenderDeviceSelection(),
|
||||
'update_branch': updateBranch,
|
||||
'ui_open_browser_on_start': uiOpenBrowserOnStartField.checked,
|
||||
'listen_to_network': listenToNetworkField.checked,
|
||||
'listen_port': listenPortField.value,
|
||||
'test_sd2': testSD2Field.checked
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (listenPortField.value < 1 || listenPortField.value > 65535) {
|
||||
alert('The network port must be a number from 1 to 65535')
|
||||
return
|
||||
}
|
||||
let updateBranch = (useBetaChannelField.checked ? 'beta' : 'main')
|
||||
changeAppConfig({
|
||||
'render_devices': getCurrentRenderDeviceSelection(),
|
||||
'update_branch': updateBranch,
|
||||
'ui_open_browser_on_start': uiOpenBrowserOnStartField.checked,
|
||||
'listen_to_network': listenToNetworkField.checked,
|
||||
'listen_port': listenPortField.value,
|
||||
'test_sd2': testSD2Field.checked
|
||||
})
|
||||
saveSettingsBtn.classList.add('active')
|
||||
asyncDelay(300).then(() => saveSettingsBtn.classList.remove('active'))
|
||||
})
|
||||
|
Reference in New Issue
Block a user