Dashboard: a reasoning chooser, offering only what the model accepts
Reasoning effort isn't a backend flag -- vLLM's --reasoning-parser only parses
the output. It's a chat-template kwarg read per request, and the models differ:
Qwen3.8 27B's template takes enable_thinking plus reasoning_effort in
('low','medium','xhigh') and raises on anything else, while Ornith 1.5 9B takes
only enable_thinking. Note 'xhigh', not OpenAI's 'high'.
So the chooser is built from what the loaded model's own template actually reads
(hfcache.template_controls), with the level names from the catalog, which is the
part that can't be inferred -- a level the template doesn't know would make it
raise, so an undeclared or unreadable one is never offered or sent.
The proxy injects the setting into chat completions, with a key the client set
itself always winning, the same precedence mlx_lm gives its own
--chat-template-kwargs. Reading it from config per request (mtime-cached) means
the dashboard changes it with no restart, so the model stays loaded -- the
startup flag would have cost a full reload per change.
vLLM gets no control: llm-host runs it without a proxy, so there is nothing in
the path to inject the kwarg. The panel hides itself rather than pretend.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
944eda06cc
commit
623d093b81
6 changed files with 395 additions and 44 deletions
|
|
@ -63,6 +63,15 @@ h1 span { color: var(--muted); font-weight: 500; }
|
|||
}
|
||||
.loadline b { color: var(--warn); font-family: system-ui, sans-serif; margin-right: 6px; }
|
||||
.btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
|
||||
.effort { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
|
||||
.effort .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
|
||||
.effort .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
|
||||
.effort select {
|
||||
background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
|
||||
padding: 6px 10px; font: inherit; font-size: 13px; min-width: 150px;
|
||||
}
|
||||
.effort select:disabled { color: var(--muted); }
|
||||
.effort .s { color: var(--muted); font-size: 12px; margin-top: 7px; line-height: 1.45; }
|
||||
button {
|
||||
font: inherit; font-size: 13px; font-weight: 550; padding: 7px 13px; border-radius: 8px; cursor: pointer;
|
||||
border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
|
||||
|
|
@ -171,6 +180,15 @@ pre {
|
|||
<div class="repo" id="cur-repo"></div>
|
||||
<div class="hwline" id="hwline"></div>
|
||||
<div class="loadline" id="loadline"><b id="load-title">Loading</b><span id="load-text"></span></div>
|
||||
<div class="effort" id="effort" hidden>
|
||||
<div class="k">Reasoning</div>
|
||||
<div class="row">
|
||||
<select id="effort-sel"></select>
|
||||
<span class="meta" id="effort-state"></span>
|
||||
</div>
|
||||
<div class="s" id="effort-note"></div>
|
||||
</div>
|
||||
|
||||
<div class="btns">
|
||||
<button id="btn-restart">Restart</button>
|
||||
<button id="btn-stop" class="danger">Stop</button>
|
||||
|
|
@ -411,8 +429,58 @@ function render(s) {
|
|||
chart("c-power", h.map((p) => p.power), "var(--c5)", plim, (v) => Math.round(v) + " W");
|
||||
}
|
||||
renderRuns(s);
|
||||
renderEffort(s);
|
||||
}
|
||||
|
||||
let effortBusy = false;
|
||||
|
||||
function renderEffort(s) {
|
||||
const r = s.reasoning || {}, box = $("effort"), sel = $("effort-sel");
|
||||
const opts = r.options || [];
|
||||
// Hidden rather than disabled when there is nothing to choose: on vLLM there's no proxy
|
||||
// to inject the kwarg, and a model whose template has no switches has nothing to offer.
|
||||
box.hidden = !opts.length && !r.why;
|
||||
if (!opts.length) {
|
||||
sel.innerHTML = "";
|
||||
sel.disabled = true;
|
||||
$("effort-state").textContent = "";
|
||||
$("effort-note").textContent = r.why || "";
|
||||
return;
|
||||
}
|
||||
if (effortBusy) return;
|
||||
const want = opts.map((o) => o.value).join("|");
|
||||
if (sel.dataset.sig !== want) {
|
||||
sel.dataset.sig = want;
|
||||
sel.innerHTML = "";
|
||||
for (const o of opts) {
|
||||
const el = document.createElement("option");
|
||||
el.value = o.value;
|
||||
el.textContent = o.label;
|
||||
sel.append(el);
|
||||
}
|
||||
}
|
||||
sel.value = r.value || "default";
|
||||
sel.disabled = s.phase !== "ready";
|
||||
$("effort-state").textContent = s.phase === "ready" ? "" : "available once the model is ready";
|
||||
$("effort-note").textContent = "Applies to requests that don't set their own; takes effect "
|
||||
+ "on the next request, with no reload.";
|
||||
}
|
||||
|
||||
$("effort-sel").onchange = async (e) => {
|
||||
const value = e.target.value;
|
||||
effortBusy = true;
|
||||
try {
|
||||
await api("/api/reasoning", { method: "POST", body: JSON.stringify({ value }) });
|
||||
const opt = e.target.selectedOptions[0];
|
||||
toast(`Reasoning: ${opt ? opt.textContent : value}`);
|
||||
} catch (err) {
|
||||
toast("Couldn't change reasoning");
|
||||
} finally {
|
||||
effortBusy = false;
|
||||
poll();
|
||||
}
|
||||
};
|
||||
|
||||
function renderRuns(s) {
|
||||
const runs = s.runs || [], body = $("runs-body"), foot = $("runs-foot");
|
||||
$("runs-empty").hidden = runs.length > 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue