Self-hosted AI workspace.
Python
Align serve backend controls
pewdiepie-archdaemonb248bb3da6c9
diff --git a/static/js/cookbookServe.js b/static/js/cookbookServe.jsindex 5a5d6dfc1..099da1779 100644--- a/static/js/cookbookServe.js+++ b/static/js/cookbookServe.js@@ -1258,7 +1258,7 @@ function _rerenderCachedModels() {// stays as the source-of-truth so every existing change handler// (updateBackendVisibility, runtime readiness, command builder)// still fires via dispatchEvent('change') on selection.- panelHtml += `<label>${_l('Engine','Inference engine: vLLM, SGLang, llama.cpp, Ollama, or Diffusers')}<div class="hwfit-backend-picker" data-backend-picker style="position:relative;width:100%;"><select class="hwfit-sf hwfit-backend-source" data-field="backend" style="display:none;">${backendOpts}</select><button type="button" class="hwfit-backend-btn" data-backend-btn aria-haspopup="listbox" aria-expanded="false" style="display:flex;align-items:center;gap:6px;width:100%;height:28px;padding:0 8px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:4px;font:inherit;font-size:11px;cursor:pointer;text-align:left;position:relative;top:-3px;"><span class="hwfit-backend-btn-icon" data-backend-icon-slot aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--accent, var(--red));flex-shrink:0;"></span><span class="hwfit-backend-btn-label" data-backend-label style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"></span><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="opacity:0.6;flex-shrink:0;"><polyline points="6 9 12 15 18 9"/></svg></button><div class="hwfit-backend-menu" data-backend-menu role="listbox" hidden style="position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:100;background:var(--panel, var(--bg));border:1px solid var(--border);border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,0.22);padding:4px;"></div></div></label>`;+ panelHtml += `<label>${_l('Engine','Inference engine: vLLM, SGLang, llama.cpp, Ollama, or Diffusers')}<div class="hwfit-backend-picker" data-backend-picker style="position:relative;width:100%;"><select class="hwfit-sf hwfit-backend-source" data-field="backend" style="display:none;">${backendOpts}</select><button type="button" class="hwfit-backend-btn" data-backend-btn aria-haspopup="listbox" aria-expanded="false" style="display:flex;align-items:center;gap:6px;width:100%;height:32px;padding:0 8px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:4px;font:inherit;font-size:11px;cursor:pointer;text-align:left;position:relative;top:-3px;"><span class="hwfit-backend-btn-icon" data-backend-icon-slot aria-hidden="true" style="display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--accent, var(--red));flex-shrink:0;"></span><span class="hwfit-backend-btn-label" data-backend-label style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"></span><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="opacity:0.6;flex-shrink:0;"><polyline points="6 9 12 15 18 9"/></svg></button><div class="hwfit-backend-menu" data-backend-menu role="listbox" hidden style="position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:100;background:var(--panel, var(--bg));border:1px solid var(--border);border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,0.22);padding:4px;"></div></div></label>`;panelHtml += `<input type="hidden" class="hwfit-sf" data-field="host" value="${esc(_es.remoteHost || '')}" />`;// Inference mode pill (llama.cpp only) — lives directly to the// RIGHT of Backend in Row 1 so the engine and the GPU/CPU choice@@ -1383,10 +1383,9 @@ function _rerenderCachedModels() {// tuning, or any other KEY=VALUE pair that doesn't have a dedicated// field. After the venv activate runs, $VIRTUAL_ENV / $PATH / etc. are// already exported so they expand correctly here.- // grid-column: 1 / -1 makes Env span every column of the Advanced- // row's CSS grid (the old flex:1 1 100% did nothing in a grid- // container — left an empty trailing column gap on wide modals).- panelHtml += `<label class="hwfit-backend-vllm hwfit-backend-sglang" style="grid-column:2 / -1;">${_l('Env','Extra KEY=VALUE env-var pairs prepended to the launch (space-separated). The Env Preset above covers the usual MiniMax M3 values; use this for additional overrides.')}<input type="text" class="hwfit-sf" data-field="extra_env" value="${esc(svm('extra_env', sv('extra_env','')))}" placeholder="NCCL_P2P_DISABLE=1" style="width:100%;" /></label>`;+ // CSS places this beside vLLM's Env Preset, but lets it span the full+ // row for SGLang where that preset field is hidden.+ panelHtml += `<label class="hwfit-backend-vllm hwfit-backend-sglang hwfit-extra-env-label">${_l('Env','Extra KEY=VALUE env-var pairs prepended to the launch (space-separated). The Env Preset above covers the usual MiniMax M3 values; use this for additional overrides.')}<input type="text" class="hwfit-sf" data-field="extra_env" value="${esc(svm('extra_env', sv('extra_env','')))}" placeholder="NCCL_P2P_DISABLE=1" style="width:100%;" /></label>`;panelHtml += `</div>`;// Row 2b: Diffusers settingsconst diffDtypeOpts = ['bfloat16','float16','float32'].map(d => `<option value="${d}"${sv('diff_dtype','bfloat16')===d?' selected':''}>${d}</option>`).join('');@@ -1937,6 +1936,7 @@ function _rerenderCachedModels() {function updateBackendVisibility() {const b = panel.querySelector('[data-field="backend"]')?.value || 'vllm';+ panel.dataset.backendActive = b;panel.querySelectorAll('[class*="hwfit-backend-"]').forEach(el => {// Skip the entire backend-picker subtree — the picker's own// classes (`hwfit-backend-picker`, `-btn`, `-menu`, `-item`,diff --git a/static/style.css b/static/style.cssindex 336fe5332..edfb49d89 100644--- a/static/style.css+++ b/static/style.css@@ -20339,10 +20339,16 @@ body.gallery-selecting .gallery-dl-btn,.hwfit-sf[data-field="backend"],.hwfit-sf[data-field="dtype"],.hwfit-sf[data-field="tp"] {- height: 28px;+ height: 32px;box-sizing: border-box;width: 100%;}+.hwfit-extra-env-label {+ grid-column: 1 / -1;+}+.hwfit-serve-panel[data-backend-active="vllm"] .hwfit-extra-env-label {+ grid-column: 2 / -1;+}.hwfit-sf:focus {border-color: var(--accent, var(--red));outline: none;