Fix bulk actions, create chats lazily, rework the UI

Seven reported problems.

**Bulk model actions 404'd.** /admin/models/{model_id} was registered
before /admin/models/bulk, and FastAPI matches in registration order, so
"bulk" was parsed as a model id. Moved above the parameterised route,
with a comment saying why, and a regression test.

**Empty chats piled up.** There is now no endpoint that creates one.
"New chat" is a link to /chat, which renders a composer with no row
behind it, and POST /api/chats/start writes the chat together with its
first message. Opening one and walking away leaves nothing.

**Pinning meant two different things.** The picker is now always in the
administrator's position order; pinned models get shortcuts in the chat
sidebar and nothing else. A picker whose order silently differs from the
admin screen is just confusing.

**Model images were missing in chat.** Assistant bubbles now show the
avatar of the model that actually wrote the turn -- which is not always
the model the chat is set to now -- falling back to the LLeMbas mark.
The picker shows it too.

**No global or per-model system prompt.** Three layers now: instance
(Admin -> General), model (Admin -> Models), chat. Precedence, not
concatenation: most specific wins outright. Stacking them reads well in
a settings screen and badly in practice, because two layers that
disagree give the model contradictory instructions and nobody can tell
which is losing. The chat panel shows the inherited prompt as
placeholder text so "leave empty to inherit" is not a guess.

**Alignment and button sizing.** Added --control-h and friends to
tokens.css; every button, input and select takes its height from them,
so a mixed row is flush by construction rather than by per-instance
nudging. Icon buttons are square at that height. Added .btn-row,
.card__header/.card__footer and .grid so pages stop carrying inline
styles, and moved every admin page onto them.

**Settings needed structure.** The user settings page is now tabbed
(Account / Models / Appearance / Security) using radio inputs and
sibling selectors -- no JavaScript, and the browser keeps the chosen tab
across a re-render.

Caught while checking: the chat.css surgery had deleted the attachment,
chip and dropzone rules. Restored, and there is now a check that every
literal class used in a template has a CSS rule.

197 tests, ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaroslav Beneš
2026-07-21 12:59:52 +02:00
parent d90195015c
commit 29db54960e
29 changed files with 1238 additions and 532 deletions
+14 -45
View File
@@ -48,6 +48,7 @@
overflow: hidden;
}
.msg__mark { width: 2rem; height: 2rem; }
.msg__avatar { width: 2rem; height: 2rem; border-radius: var(--radius); }
.msg__initial {
width: 2rem; height: 2rem;
display: grid;
@@ -310,11 +311,10 @@
border-top: 1px solid var(--border);
background: var(--bg);
}
.composer__inner { max-width: var(--thread-max-width); margin: 0 auto; }
.composer__form {
max-width: var(--thread-max-width);
margin: 0 auto;
display: flex;
gap: var(--sp-2);
gap: var(--sp-1);
align-items: flex-end;
padding: var(--sp-2);
border: 1px solid var(--border);
@@ -322,37 +322,33 @@
background: var(--surface);
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
/* Attach and send are the same size and sit on the same baseline as the last
line of the textarea, so the control row reads as one object. */
.composer__btn { flex: none; align-self: flex-end; border-radius: var(--radius-full); }
.composer__form:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.composer__input {
flex: 1;
min-width: 0;
border: 0;
background: none;
resize: none;
padding: var(--sp-2);
padding: 0.5rem var(--sp-2);
font-size: var(--text-base);
line-height: var(--leading-normal);
max-height: 20rem;
color: var(--ink);
}
.composer__input:focus { outline: none; }
.composer__send { border-radius: var(--radius-full); padding: 0.55rem 0.7rem; }
.composer__hint {
max-width: var(--thread-max-width);
margin: var(--sp-2) auto 0;
margin: var(--sp-2) 0 0;
font-size: var(--text-xs);
color: var(--ink-faint);
text-align: center;
}
.select--compact {
width: auto;
max-width: 16rem;
padding: 0.3rem 0.5rem;
font-size: var(--text-sm);
}
/* --- Folders -------------------------------------------------------------- */
.folder__row { padding-right: var(--sp-1); }
.folder__toggle {
@@ -386,38 +382,11 @@
text-decoration: none;
}
/* --- Chat settings panel -------------------------------------------------- */
.chat-settings {
flex: none;
border-bottom: 1px solid var(--border);
background: var(--bg-sunken);
max-height: 60vh;
overflow-y: auto;
}
.chat-settings__inner {
max-width: var(--thread-max-width);
margin: 0 auto;
padding: var(--sp-4) var(--sp-5);
}
.chat-settings__note {
color: var(--ink-muted);
font-size: var(--text-sm);
font-style: italic;
margin-bottom: var(--sp-4);
}
.chat-settings__params {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
gap: var(--sp-3);
}
.chat-settings__params .field { margin-bottom: 0; }
/* --- Attachment chips (composer) ------------------------------------------ */
.composer { position: relative; }
.composer__attachments {
max-width: var(--thread-max-width);
margin: 0 auto var(--sp-2);
margin: 0 0 var(--sp-2);
display: flex;
flex-wrap: wrap;
gap: var(--sp-2);
@@ -451,8 +420,6 @@
.chip__meta { font-size: var(--text-xs); color: var(--ink-faint); }
.chip__warning { font-size: var(--text-xs); color: var(--danger); }
.composer__attach { flex: none; align-self: flex-end; }
/* --- Drag and drop -------------------------------------------------------- */
.dropzone-overlay {
position: absolute;
@@ -534,7 +501,9 @@
}
/* --- Theme toggle --------------------------------------------------------- */
/* Only the icon for the theme you would switch TO is shown. */
/* Only the icon for the theme you would switch TO is shown. Both live in the
same button, so the wrapper must not add a line box of its own. */
.theme-icon { display: flex; }
:root[data-theme="moria"] .theme-icon--dark { display: none; }
:root[data-theme="shire"] .theme-icon--light { display: none; }