The menu that never appeared, and the reason it never did
composer.js built its menu lazily inside show(), and refresh() wrote list.innerHTML before calling it. `list` is null until build() has run, so the first `/` or `@` ever typed threw a TypeError and took the handler with it. The menu has never appeared in any browser. That is why /compact "isn't there": nothing was. I shipped it having only run `node --check`, which parses the file happily. So this also brings the thing that catches it: a DOM stub driven under node -- not committed, hard rule 1 stands, it is an instrument like curl. It reproduced the crash in one run and immediately found two more: choosing a command from the menu left `/help` sitting in the box so the next Enter ran it again, and Tab completed nothing. Tab now completes and Enter runs, which is the split that matters for a command taking an argument. `.select--sm` was used three times and defined nowhere. I deleted the copy in chat.css and left a comment saying it "is defined once, in app.css", where it did not exist -- so those selects fell back to plain `.select`: width 100% in a flex row where four siblings wanted the same, all of them shrinking together until each was a few characters wide, and half a rem taller than everything beside them. That was the whole of "the connection switch needs to be wider". The connection and directory move to the topbar. They cannot change -- update_chat refuses both with a 409 -- so they are facts about the chat, of a kind with the Temporary badge, not controls on the message. The mode stays by the box. Compaction says it is working. It makes a model call that takes seconds and had no indicator anywhere: `hx-indicator` appears nowhere in this codebase, and the Generation.status channel that says "Summarising earlier messages…" for the automatic path cannot be borrowed, because it lives in the streaming bubble and this endpoint refuses to run while any message is unfinished. The overflow menu now runs the same code as /compact rather than posting for itself, so there is one implementation, one spinner, and one place the endpoint's four carefully written 409s finally reach somebody. /effort, low medium high, per chat with a per-model default. It goes out twice because there is no field that works everywhere: OpenAI and vLLM read reasoning_effort, llama.cpp's own docs say other values "have no effect" and its maintainer says the field "simply gets dropped without error or logging" -- what reaches gpt-oss behind it is chat_template_kwargs. Both are sent, and only once an effort has been chosen, so a provider strict about unknown parameters sees exactly the request it always did until somebody opts in. The control appears only on a model marked `reasoning`, a flag that has existed since the beginning with no reader at all. Mentions and recognised commands are marked as you type -- a mirror behind the textarea holding the same text with every character transparent, contributing nothing but a rounded rectangle, so a pixel of drift is a misplaced rectangle rather than a doubled glyph. A command is marked only when it resolves, so `/thoughts on this` visibly is not one before you send it. And again in the transcript, where user turns had no render step at all and now escape before they inject. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ from lembas.db.models import (
|
||||
ROLE_USER,
|
||||
Chat,
|
||||
Message,
|
||||
Model,
|
||||
User,
|
||||
)
|
||||
from lembas.db.session import session_scope
|
||||
@@ -92,6 +93,21 @@ def _new_chat(
|
||||
if chosen is None:
|
||||
chosen = chat_service.default_model(db, user)
|
||||
|
||||
# `Model.params_json` has said "default sampling params applied to new chats
|
||||
# using this model" since it was added and has been applied nowhere. It is
|
||||
# empty on every existing row, so honouring it now changes nothing until an
|
||||
# administrator sets something -- and it is what makes a per-model default
|
||||
# reasoning effort possible without a second column meaning the same thing.
|
||||
defaults: dict = {}
|
||||
if chosen is not None:
|
||||
model = db.scalar(
|
||||
select(Model).where(
|
||||
Model.model_id == chosen[0], Model.connection_id == chosen[1]
|
||||
)
|
||||
)
|
||||
if model is not None:
|
||||
defaults = dict(model.params_json or {})
|
||||
|
||||
profile = _agent_target(db, user, kind, ssh_profile_id)
|
||||
chat = Chat(
|
||||
user_id=user.id,
|
||||
@@ -102,6 +118,7 @@ def _new_chat(
|
||||
kind=KIND_AGENT if profile is not None else KIND_CHAT,
|
||||
ssh_profile_id=profile.id if profile is not None else None,
|
||||
project_dir=(project_dir.strip() or profile.default_dir) if profile is not None else "",
|
||||
params_json=defaults,
|
||||
)
|
||||
# Ignored rather than refused when it is not a mode, matching how every
|
||||
# other bad value here collapses: somebody who mistypes should get a chat
|
||||
@@ -1020,6 +1037,20 @@ async def update_chat(request: Request, db: Db, user: RequiredUser, chat_id: str
|
||||
**_clean_params(**{k: str(v) for k, v in submitted_params.items()}),
|
||||
}
|
||||
|
||||
# Not a number, so it cannot go through _PARAM_RANGES. Empty means clear it,
|
||||
# the same as every other parameter here; anything that is not one of the
|
||||
# three is ignored rather than refused, so a typo does not cost a message.
|
||||
if "reasoning_effort" in form:
|
||||
if not allowed.get("chat.params"):
|
||||
raise HTTPException(
|
||||
status.HTTP_403_FORBIDDEN, "You may not change sampling parameters."
|
||||
)
|
||||
wanted = str(form["reasoning_effort"]).strip().lower()
|
||||
if not wanted:
|
||||
chat.params_json = {**(chat.params_json or {}), "reasoning_effort": None}
|
||||
elif wanted in chat_service.EFFORTS:
|
||||
chat.params_json = {**(chat.params_json or {}), "reasoning_effort": wanted}
|
||||
|
||||
db.commit()
|
||||
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user