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 bdce2764b1
commit 7b67568f2c
30 changed files with 1264 additions and 536 deletions
+169 -33
View File
@@ -84,29 +84,37 @@ button, input, textarea, select {
/* The leaf is a filled silhouette, not a stroked pictogram. */
.icon--leaf { fill: currentColor; stroke: none; }
/* --- Buttons -------------------------------------------------------------- */
/* --- Buttons ---------------------------------------------------------------
Every variant is the same height and vertically centres its contents, so a
row of mixed buttons lines up without per-instance nudging. Icon buttons are
square at that height rather than a different shape.
*/
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--sp-2);
padding: 0.5rem 0.9rem;
height: var(--control-h);
padding: 0 var(--control-px);
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface-raised);
color: var(--ink);
font-size: var(--text-sm);
font-weight: 500;
line-height: 1;
cursor: pointer;
white-space: nowrap;
text-decoration: none;
transition: background var(--transition-fast), border-color var(--transition-fast),
color var(--transition-fast);
white-space: nowrap;
}
.btn:hover:not(:disabled) {
background: var(--surface-hover);
border-color: var(--border-strong);
color: var(--ink);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
background: var(--accent);
@@ -116,37 +124,58 @@ button, input, textarea, select {
.btn--primary:hover:not(:disabled) {
background: var(--accent-hover);
border-color: var(--accent-hover);
color: var(--accent-ink);
}
.btn--danger { color: var(--danger); border-color: var(--border); }
.btn--danger { color: var(--danger); }
.btn--danger:hover:not(:disabled) {
background: var(--danger-soft);
border-color: var(--danger);
color: var(--danger);
}
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: transparent; }
/* Square, and the same height as everything beside it. */
.btn--icon {
padding: 0.4rem;
border-radius: var(--radius);
width: var(--control-h);
padding: 0;
background: transparent;
border-color: transparent;
color: var(--ink-muted);
}
.btn--icon:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.btn--icon.btn--primary {
color: var(--accent-ink);
background: var(--accent);
border-color: var(--accent);
}
.btn--sm { height: var(--control-h-sm); padding: 0 var(--control-px-sm); font-size: var(--text-xs); }
.btn--sm.btn--icon { width: var(--control-h-sm); padding: 0; }
.btn--lg { height: var(--control-h-lg); padding: 0 var(--sp-5); font-size: var(--text-base); }
.btn--block { width: 100%; }
.btn--sm { padding: 0.3rem 0.6rem; font-size: var(--text-xs); }
.btn--grow { flex: 1; }
/* --- Forms ---------------------------------------------------------------- */
/* Rows of buttons: gap and alignment in one place, not per instance. */
.btn-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.btn-row--end { justify-content: flex-end; }
.spacer { flex: 1; }
/* --- Forms -----------------------------------------------------------------
Inputs share the button height, so a control row is flush by construction.
*/
.field { margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }
.field__label {
display: block;
margin-bottom: var(--sp-2);
font-size: var(--text-sm);
font-weight: 500;
color: var(--ink-muted);
color: var(--ink);
}
.field__hint {
margin-top: var(--sp-2);
@@ -156,17 +185,31 @@ button, input, textarea, select {
}
.input,
.textarea,
.select {
width: 100%;
padding: 0.55rem 0.7rem;
height: var(--control-h);
padding: 0 var(--control-px);
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-sunken);
color: var(--ink);
font-size: var(--text-base);
font-size: var(--text-sm);
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.textarea {
width: 100%;
padding: var(--sp-2) var(--control-px);
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-sunken);
color: var(--ink);
font-size: var(--text-sm);
line-height: var(--leading-normal);
resize: vertical;
min-height: 5rem;
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus,
.textarea:focus,
.select:focus {
@@ -175,8 +218,29 @@ button, input, textarea, select {
box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.textarea { resize: vertical; min-height: 5rem; line-height: var(--leading-normal); }
.input--mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.input--mono, .textarea--mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.select {
appearance: none;
padding-right: var(--sp-8);
/* Chevron drawn in CSS, so no icon font and no extra element. */
background-image:
linear-gradient(45deg, transparent 50%, currentColor 50%),
linear-gradient(135deg, currentColor 50%, transparent 50%);
background-position: right 1.1rem center, right 0.85rem center;
background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
background-repeat: no-repeat;
cursor: pointer;
}
/* Sits inside a composed control that draws its own frame (the model picker). */
.select--bare {
border-color: transparent;
background-color: transparent;
width: auto;
max-width: 14rem;
padding-left: var(--sp-1);
}
.select--bare:focus { box-shadow: none; }
.checkbox {
display: flex;
@@ -184,8 +248,20 @@ button, input, textarea, select {
gap: var(--sp-2);
font-size: var(--text-sm);
cursor: pointer;
line-height: var(--leading-normal);
}
.checkbox input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.checkbox input {
accent-color: var(--accent);
width: 1rem;
height: 1rem;
flex: none;
cursor: pointer;
}
/* Multi-column form layout, one definition. */
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
/* --- Alerts --------------------------------------------------------------- */
.alert {
@@ -220,12 +296,8 @@ button, input, textarea, select {
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
/* --- Application shell ---------------------------------------------------- */
.shell {
display: flex;
height: 100dvh;
overflow: hidden;
}
/* --- Application shell ----------------------------------------------------- */
.shell { display: flex; height: 100dvh; overflow: hidden; }
.sidebar {
width: var(--sidebar-width);
@@ -234,14 +306,13 @@ button, input, textarea, select {
flex-direction: column;
background: var(--bg-sunken);
border-right: 1px solid var(--border);
transition: margin-left var(--transition);
min-height: 0;
}
.sidebar[hidden] { display: none; }
.sidebar__header {
display: flex;
align-items: center;
gap: var(--sp-2);
height: var(--header-height);
padding: 0 var(--sp-3);
flex: none;
@@ -259,13 +330,20 @@ button, input, textarea, select {
min-width: 0;
}
.sidebar__brand:hover { color: var(--ink); }
.sidebar__brand .brand-mark { width: 1.6rem; height: 1.6rem; flex: none; }
.sidebar__brand .brand-mark { width: 1.65rem; height: 1.65rem; flex: none; }
.sidebar__brand .brand-llm { color: var(--gold); }
.sidebar__actions { padding: 0 var(--sp-3) var(--sp-3); display: flex; gap: var(--sp-2); }
.sidebar__actions {
display: flex;
align-items: center;
gap: var(--sp-2);
padding: 0 var(--sp-3) var(--sp-3);
flex: none;
}
.sidebar__scroll {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 0 var(--sp-2) var(--sp-3);
scrollbar-width: thin;
@@ -276,13 +354,18 @@ button, input, textarea, select {
flex: none;
border-top: 1px solid var(--border);
padding: var(--sp-2);
display: flex;
flex-direction: column;
gap: var(--sp-1);
}
.sidebar__tools { display: flex; align-items: center; gap: var(--sp-1); }
.main {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
background: var(--bg);
}
@@ -306,10 +389,52 @@ button, input, textarea, select {
min-width: 0;
flex: 1;
}
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
/* --- Sidebar navigation --------------------------------------------------- */
/* The model picker: an avatar and a select sharing one frame, so it reads as a
single control rather than two things that happen to be adjacent. */
.model-select {
display: flex;
align-items: center;
gap: var(--sp-2);
height: var(--control-h);
padding: 0 var(--sp-1) 0 var(--sp-2);
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
cursor: pointer;
transition: border-color var(--transition-fast);
}
.model-select:hover { border-color: var(--border-strong); }
.model-select:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.model-select__avatar { width: 1.4rem; height: 1.4rem; border-radius: var(--radius-sm); }
/* Collapsible settings panel, shared by chat settings and anything like it. */
.panel {
flex: none;
border-bottom: 1px solid var(--border);
background: var(--bg-sunken);
max-height: 60vh;
overflow-y: auto;
}
.panel__inner {
max-width: var(--thread-max-width);
margin: 0 auto;
padding: var(--sp-5);
}
.panel__note {
color: var(--ink-muted);
font-size: var(--text-sm);
font-style: italic;
margin-bottom: var(--sp-4);
}
/* --- Sidebar navigation ---------------------------------------------------- */
.nav-group { margin-bottom: var(--sp-4); }
.nav-group:last-child { margin-bottom: 0; }
.nav-group__label {
display: flex;
align-items: center;
@@ -326,7 +451,8 @@ button, input, textarea, select {
display: flex;
align-items: center;
gap: var(--sp-2);
padding: 0.4rem var(--sp-2);
min-height: var(--control-h);
padding: 0 var(--sp-2);
border-radius: var(--radius);
color: var(--ink-muted);
text-decoration: none;
@@ -335,7 +461,11 @@ button, input, textarea, select {
position: relative;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.is-active { background: var(--surface-active); color: var(--ink); font-weight: 500; }
.nav-item.is-active {
background: var(--surface-active);
color: var(--ink);
font-weight: 500;
}
.nav-item__label {
overflow: hidden;
text-overflow: ellipsis;
@@ -343,11 +473,16 @@ button, input, textarea, select {
flex: 1;
min-width: 0;
}
/* Row actions stay hidden until the row is hovered or focused within, so the
list reads calmly, but they remain keyboard reachable. */
.nav-item__avatar { width: 1.4rem; height: 1.4rem; border-radius: var(--radius-sm); flex: none; }
.nav-item--model .nav-item__label { font-weight: 500; }
/* Row actions stay hidden until hover or focus, so the list reads calmly while
remaining keyboard reachable. */
.nav-item__actions {
display: flex;
align-items: center;
gap: 0.1rem;
flex: none;
opacity: 0;
transition: opacity var(--transition-fast);
}
@@ -355,7 +490,8 @@ button, input, textarea, select {
.nav-item:focus-within .nav-item__actions { opacity: 1; }
.nav-empty {
padding: var(--sp-3) var(--sp-2);
padding: var(--sp-2);
margin: 0;
font-size: var(--text-xs);
color: var(--ink-faint);
font-style: italic;