Add grouping to model list

This commit is contained in:
Karl 2025-06-06 13:10:32 +01:00
parent 4272e1d40e
commit ac388b0f4e
2 changed files with 14 additions and 7 deletions

View File

@ -98,7 +98,7 @@ def cancel_job() -> None:
def create():
if request.method == "POST":
prompt = request.form.get("prompt")
model = request.form.get("model", "Random")
model = request.form.get("model") or "Random"
if not prompt:
prompt = create_prompt_on_openwebui(user_config["comfyui"]["prompt"])
@ -130,7 +130,6 @@ def create_image_endpoint() -> str:
"""
models = load_models_from_config()
models.insert(0, "Random")
return render_template(
"create_image.html", models=models

View File

@ -128,12 +128,20 @@
<button onclick="randomPrompt()">Random Prompt</button>
<!-- new model selector -->
<select id="model-select">
{% for m in models %}
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
{% endfor %}
<option value="" selected>Random</option>
<!-- Group: FLUX -->
<optgroup label="FLUX">
{% for m in models if 'flux' in m|lower %}
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
{% endfor %}
</optgroup>
<!-- Group: SDXL -->
<optgroup label="SDXL">
{% for m in models if 'flux' not in m|lower %}
<option value="{{ m }}">{{ m.rsplit('.', 1)[0] }}</option>
{% endfor %}
</optgroup>
</select>
</div>