mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-08-12 20:58:28 +01:00
block generation if image in queue
This commit is contained in:
parent
ad814855ab
commit
82f29a4fde
@ -113,9 +113,24 @@ def get_current_version():
|
||||
return "unknown"
|
||||
|
||||
def load_models_from_config():
|
||||
flux_models = load_config()["comfyui:flux"]["models"].split(",")
|
||||
sdxl_models = load_config()["comfyui"]["models"].split(",")
|
||||
qwen_models = load_config()["comfyui:qwen"]["models"].split(",")
|
||||
config = load_config()
|
||||
|
||||
# Only load FLUX models if FLUX feature is enabled
|
||||
use_flux = config["comfyui"].get("flux", "False").lower() == "true"
|
||||
if use_flux and "comfyui:flux" in config and "models" in config["comfyui:flux"]:
|
||||
flux_models = config["comfyui:flux"]["models"].split(",")
|
||||
else:
|
||||
flux_models = []
|
||||
|
||||
sdxl_models = config["comfyui"]["models"].split(",")
|
||||
|
||||
# Only load Qwen models if Qwen feature is enabled
|
||||
use_qwen = config["comfyui"].get("qwen", "False").lower() == "true"
|
||||
if use_qwen and "comfyui:qwen" in config and "models" in config["comfyui:qwen"]:
|
||||
qwen_models = config["comfyui:qwen"]["models"].split(",")
|
||||
else:
|
||||
qwen_models = []
|
||||
|
||||
sorted_flux_models = sorted(flux_models, key=str.lower)
|
||||
sorted_sdxl_models = sorted(sdxl_models, key=str.lower)
|
||||
sorted_qwen_models = sorted(qwen_models, key=str.lower)
|
||||
|
@ -73,6 +73,20 @@
|
||||
background: #555;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
background: #555;
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.queue-message {
|
||||
color: #ffcc00;
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
#spinner-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
@ -197,9 +211,10 @@
|
||||
|
||||
<div class="button-group">
|
||||
<button onclick="showSpinner(); location.href='/'">Back</button>
|
||||
<button onclick="sendPrompt()">Send Prompt</button>
|
||||
<button onclick="randomPrompt()">Random Prompt</button>
|
||||
<button id="send-prompt-btn" onclick="sendPrompt()">Send Prompt</button>
|
||||
<button id="random-prompt-btn" onclick="randomPrompt()">Random Prompt</button>
|
||||
</div>
|
||||
<div id="queue-message" class="queue-message"></div>
|
||||
|
||||
<div class="model-selection">
|
||||
<div class="model-group">
|
||||
@ -273,10 +288,31 @@
|
||||
{% block scripts %}
|
||||
<script>
|
||||
const overlay = document.getElementById('spinner-overlay');
|
||||
const sendPromptBtn = document.getElementById('send-prompt-btn');
|
||||
const randomPromptBtn = document.getElementById('random-prompt-btn');
|
||||
const queueMessage = document.getElementById('queue-message');
|
||||
|
||||
function showSpinner() { overlay.style.visibility = 'visible'; }
|
||||
|
||||
function updateButtonStates(queueCount) {
|
||||
if (queueCount > 0) {
|
||||
sendPromptBtn.disabled = true;
|
||||
randomPromptBtn.disabled = true;
|
||||
queueMessage.textContent = "Please wait until the current image is processed...";
|
||||
} else {
|
||||
sendPromptBtn.disabled = false;
|
||||
randomPromptBtn.disabled = false;
|
||||
queueMessage.textContent = "";
|
||||
}
|
||||
}
|
||||
|
||||
function sendPrompt() {
|
||||
// Check if buttons are disabled
|
||||
if (sendPromptBtn.disabled) {
|
||||
alert("Please wait until the current image is processed.");
|
||||
return;
|
||||
}
|
||||
|
||||
showSpinner();
|
||||
const prompt = document.getElementById('prompt-box').value;
|
||||
const model = document.getElementById('model-select').value;
|
||||
@ -302,6 +338,12 @@
|
||||
}
|
||||
|
||||
function randomPrompt() {
|
||||
// Check if buttons are disabled
|
||||
if (randomPromptBtn.disabled) {
|
||||
alert("Please wait until the current image is processed.");
|
||||
return;
|
||||
}
|
||||
|
||||
showSpinner();
|
||||
const model = document.getElementById('model-select').value;
|
||||
const promptModel = document.getElementById('prompt-model-select').value;
|
||||
@ -330,6 +372,10 @@
|
||||
const queueDropdown = document.getElementById('queue-dropdown');
|
||||
const queueCountSpan = document.getElementById('queue-count');
|
||||
|
||||
// Check initial queue count and update button states
|
||||
const initialQueueCount = parseInt(queueCountSpan.textContent) || 0;
|
||||
updateButtonStates(initialQueueCount);
|
||||
|
||||
// Toggle dropdown visibility
|
||||
queueBtn.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
@ -355,7 +401,10 @@
|
||||
fetch('/api/queue')
|
||||
.then(response => response.json())
|
||||
.then(jobs => {
|
||||
queueCountSpan.textContent = jobs.length;
|
||||
const queueCount = jobs.length;
|
||||
queueCountSpan.textContent = queueCount;
|
||||
updateButtonStates(queueCount);
|
||||
|
||||
const container = queueDropdown;
|
||||
container.innerHTML = '';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user