feat: reasoning token budget + session name in header
- reasoning_budget_tokens: optional int field on local_openai models;
when set, injects {"reasoning": {"budget_tokens": N}} via extra_body
into every OpenRouter API call (both tool-loop and confirmation-gate
rounds). Field exposed in the model edit form in Settings.
- session name moved from standalone full-row div between #messages
and #input-area into the persona-switcher block in the header, as a
third dim line under "Cortex · Local". Collapses when empty via
:empty CSS. No JS changes required.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -664,7 +664,8 @@ def save_model(username: str, model_id: str | None, host_id: str,
|
||||
label: str, model_name: str, context_k: int = 0,
|
||||
tags: list[str] | None = None,
|
||||
max_rounds: int | None = None,
|
||||
tools: bool = True) -> str:
|
||||
tools: bool = True,
|
||||
reasoning_budget_tokens: int | None = None) -> str:
|
||||
"""Create or update a local_openai model entry. Returns the model ID."""
|
||||
data = _load(username)
|
||||
tags = tags or []
|
||||
@@ -672,29 +673,31 @@ def save_model(username: str, model_id: str | None, host_id: str,
|
||||
if model_id:
|
||||
for m in data["models"]:
|
||||
if m["id"] == model_id:
|
||||
m["host_id"] = host_id
|
||||
m["label"] = label.strip() or model_name.strip()
|
||||
m["model_name"] = model_name.strip()
|
||||
m["context_k"] = context_k
|
||||
m["max_rounds"] = max_rounds
|
||||
m["tools"] = tools
|
||||
m["tags"] = tags
|
||||
m["host_id"] = host_id
|
||||
m["label"] = label.strip() or model_name.strip()
|
||||
m["model_name"] = model_name.strip()
|
||||
m["context_k"] = context_k
|
||||
m["max_rounds"] = max_rounds
|
||||
m["tools"] = tools
|
||||
m["tags"] = tags
|
||||
m["reasoning_budget_tokens"] = reasoning_budget_tokens
|
||||
_save(username, data)
|
||||
return model_id
|
||||
model_id = None
|
||||
|
||||
model_id = secrets.token_hex(4)
|
||||
data["models"].append({
|
||||
"id": model_id,
|
||||
"type": "local_openai",
|
||||
"label": label.strip() or model_name.strip(),
|
||||
"model_name": model_name.strip(),
|
||||
"provider": "local",
|
||||
"host_id": host_id,
|
||||
"context_k": context_k,
|
||||
"max_rounds": max_rounds,
|
||||
"tools": tools,
|
||||
"tags": tags,
|
||||
"id": model_id,
|
||||
"type": "local_openai",
|
||||
"label": label.strip() or model_name.strip(),
|
||||
"model_name": model_name.strip(),
|
||||
"provider": "local",
|
||||
"host_id": host_id,
|
||||
"context_k": context_k,
|
||||
"max_rounds": max_rounds,
|
||||
"tools": tools,
|
||||
"tags": tags,
|
||||
"reasoning_budget_tokens": reasoning_budget_tokens,
|
||||
})
|
||||
_save(username, data)
|
||||
return model_id
|
||||
|
||||
Reference in New Issue
Block a user