feat: reasoning level select (Off/Light/Moderate/High/Max)

Replace free-form reasoning_budget_tokens number input with a 5-level
select in both the edit form (local_llm.py) and add-model form
(local_llm.html). Values: 0 / 1024 / 4096 / 8192 / 32768 tokens.
Edit form pre-selects the stored value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-05-09 21:44:20 -04:00
parent a66c5a7f84
commit 19d6f004ed
2 changed files with 21 additions and 3 deletions

View File

@@ -211,6 +211,11 @@ def _render(username: str, success: str = "", error: str = "") -> str:
cur_tools = m.get("tools", True)
cur_tags = ", ".join(m.get("tags") or [])
cur_reasoning_budget = m.get("reasoning_budget_tokens") or 0
_rb_levels = [(0, "Off — Non-think"), (1024, "Light"), (4096, "Moderate"), (8192, "High"), (32768, "Max")]
reasoning_opts = "".join(
f'<option value="{v}" {"selected" if cur_reasoning_budget == v else ""}>{lbl}</option>'
for v, lbl in _rb_levels
)
model_rows += f'''
<div class="model-row" id="model-{m["id"]}">
@@ -258,9 +263,11 @@ def _render(username: str, success: str = "", error: str = "") -> str:
title="Per-model tool loop cap. 0 = use the global default (orchestrator_max_rounds).">
</div>
<div class="field" style="flex:0 0 auto">
<label title="OpenRouter reasoning budget in tokens. 0 = no reasoning override (model default). Injects reasoning.budget_tokens into the API call.">Reasoning tokens</label>
<input type="number" name="reasoning_budget_tokens" value="{cur_reasoning_budget}" min="0"
title="OpenRouter reasoning budget in tokens. 0 = disabled. E.g. 2048 for light thinking, 8192 for deep reasoning.">
<label title="Reasoning depth via OpenRouter's reasoning.budget_tokens. Off = Non-think. Light ~1k, Moderate ~4k, High ~8k, Max ~32k tokens.">Reasoning</label>
<select name="reasoning_budget_tokens"
title="Reasoning depth via OpenRouter's reasoning.budget_tokens. Off = Non-think. Light ~1k, Moderate ~4k, High ~8k, Max ~32k tokens.">
{reasoning_opts}
</select>
</div>
<div class="field" style="flex:0 0 auto">
<label title="Whether this model supports tool calling. If not supported, requests skip the tool loop entirely.">Tool calling</label>