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:
@@ -1,27 +1,34 @@
|
||||
/* Administration screens. */
|
||||
/* Settings and administration screens. */
|
||||
|
||||
.admin-scroll {
|
||||
/* --- Page scaffolding ------------------------------------------------------ */
|
||||
.admin-scroll,
|
||||
.tabs__body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--border-strong) transparent;
|
||||
}
|
||||
|
||||
.page,
|
||||
.admin-page {
|
||||
max-width: 46rem;
|
||||
max-width: 48rem;
|
||||
margin: 0 auto;
|
||||
padding: var(--sp-6) var(--sp-5) var(--sp-12);
|
||||
}
|
||||
|
||||
.admin-lede {
|
||||
.page-header { margin-bottom: var(--sp-6); }
|
||||
.admin-lede,
|
||||
.page-header__lede {
|
||||
color: var(--ink-muted);
|
||||
font-size: var(--text-sm);
|
||||
line-height: var(--leading-relaxed);
|
||||
margin-bottom: var(--sp-6);
|
||||
max-width: 42rem;
|
||||
margin: 0 0 var(--sp-6);
|
||||
max-width: 44rem;
|
||||
}
|
||||
|
||||
.admin-section-title {
|
||||
.admin-section-title,
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
@@ -29,6 +36,60 @@
|
||||
margin: var(--sp-8) 0 var(--sp-4);
|
||||
}
|
||||
|
||||
/* --- Tabs ------------------------------------------------------------------
|
||||
Radio inputs plus sibling selectors: no JavaScript, and the browser keeps
|
||||
the chosen tab across a re-render.
|
||||
*/
|
||||
.tabs { display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
||||
|
||||
.tabs__bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-1);
|
||||
padding: 0 var(--sp-5);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--bg);
|
||||
flex: none;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.tabs__tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
height: var(--control-h-lg);
|
||||
padding: 0 var(--sp-4);
|
||||
border-bottom: 2px solid transparent;
|
||||
color: var(--ink-muted);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: color var(--transition-fast), border-color var(--transition-fast);
|
||||
}
|
||||
.tabs__tab:hover { color: var(--ink); }
|
||||
|
||||
.tabs__panel { display: none; }
|
||||
|
||||
/* Each radio activates its own label and its own panel. Written out because
|
||||
CSS has no way to derive one from the other. */
|
||||
#tab-account:checked ~ label[for="tab-account"],
|
||||
#tab-models:checked ~ label[for="tab-models"],
|
||||
#tab-appearance:checked ~ label[for="tab-appearance"],
|
||||
#tab-security:checked ~ label[for="tab-security"] {
|
||||
color: var(--ink);
|
||||
border-bottom-color: var(--accent);
|
||||
}
|
||||
.tabs__bar:has(#tab-account:checked) ~ .tabs__body [data-tab="tab-account"],
|
||||
.tabs__bar:has(#tab-models:checked) ~ .tabs__body [data-tab="tab-models"],
|
||||
.tabs__bar:has(#tab-appearance:checked) ~ .tabs__body [data-tab="tab-appearance"],
|
||||
.tabs__bar:has(#tab-security:checked) ~ .tabs__body [data-tab="tab-security"] {
|
||||
display: block;
|
||||
}
|
||||
.tabs__tab:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
|
||||
/* --- Cards ----------------------------------------------------------------- */
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
@@ -36,27 +97,21 @@
|
||||
padding: var(--sp-5);
|
||||
margin-bottom: var(--sp-4);
|
||||
}
|
||||
.card:last-child { margin-bottom: 0; }
|
||||
.card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
font-size: var(--text-md);
|
||||
margin-bottom: var(--sp-4);
|
||||
margin-bottom: var(--sp-2);
|
||||
}
|
||||
|
||||
.form-grid { display: block; }
|
||||
.form-grid .field:last-of-type { margin-bottom: 0; }
|
||||
.field--actions { margin-top: var(--sp-5); margin-bottom: 0; }
|
||||
|
||||
.connection__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-3);
|
||||
.card__lede {
|
||||
color: var(--ink-muted);
|
||||
font-size: var(--text-sm);
|
||||
margin-bottom: var(--sp-4);
|
||||
flex-wrap: wrap;
|
||||
line-height: var(--leading-relaxed);
|
||||
}
|
||||
.connection__footer {
|
||||
.card__footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -66,8 +121,36 @@
|
||||
border-top: 1px solid var(--border);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.card__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-3);
|
||||
margin-bottom: var(--sp-4);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* Reachable status at a glance: green working, red errored, grey disabled. */
|
||||
/* Legacy aliases so existing admin templates keep their spacing. */
|
||||
.form-grid { display: block; }
|
||||
.connection__head { display: flex; align-items: center; justify-content: space-between;
|
||||
gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
|
||||
.connection__footer { display: flex; align-items: center; justify-content: space-between;
|
||||
gap: var(--sp-3); margin-top: var(--sp-5); padding-top: var(--sp-4);
|
||||
border-top: 1px solid var(--border); flex-wrap: wrap; }
|
||||
.field--actions { margin-top: var(--sp-5); margin-bottom: 0; }
|
||||
|
||||
/* --- Definition lists ------------------------------------------------------ */
|
||||
.detail-list {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(6rem, auto) 1fr;
|
||||
gap: var(--sp-2) var(--sp-4);
|
||||
margin: 0;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
.detail-list dt { color: var(--ink-muted); font-weight: 500; }
|
||||
.detail-list dd { margin: 0; }
|
||||
|
||||
/* --- Status ---------------------------------------------------------------- */
|
||||
.status-dot {
|
||||
width: 0.55rem;
|
||||
height: 0.55rem;
|
||||
@@ -79,44 +162,25 @@
|
||||
.status-dot.is-bad { background: var(--danger); }
|
||||
.status-dot.is-off { background: var(--ink-faint); }
|
||||
|
||||
.model-list { list-style: none; margin: 0; padding: 0; }
|
||||
.model-list__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-3);
|
||||
padding: var(--sp-2) 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.model-list__item:last-child { border-bottom: 0; }
|
||||
.model-list__id {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--text-sm);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav-item.is-disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
.nav-item.is-disabled:hover { background: none; color: var(--ink-muted); }
|
||||
|
||||
/* --- Model list ----------------------------------------------------------- */
|
||||
/* --- Model list ------------------------------------------------------------ */
|
||||
.bulk-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
flex-wrap: wrap;
|
||||
padding: var(--sp-3);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--surface);
|
||||
margin-bottom: var(--sp-4);
|
||||
}
|
||||
.bulk-bar .model-rows { flex-basis: 100%; margin-top: var(--sp-3); }
|
||||
.bulk-bar__label { font-size: var(--text-sm); color: var(--ink-muted); margin-right: var(--sp-1); }
|
||||
|
||||
.model-rows {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
background: var(--surface);
|
||||
}
|
||||
.model-row {
|
||||
display: flex;
|
||||
@@ -124,31 +188,43 @@
|
||||
gap: var(--sp-3);
|
||||
padding: var(--sp-3);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
}
|
||||
.model-row:last-child { border-bottom: 0; }
|
||||
.model-row.is-off { opacity: 0.55; }
|
||||
.model-row.is-off { opacity: 0.5; }
|
||||
.model-row__check { accent-color: var(--accent); width: 1rem; height: 1rem; flex: none; }
|
||||
.model-row__avatar { flex: none; }
|
||||
.model-row__avatar { flex: none; width: 2rem; height: 2rem; }
|
||||
.model-row__main { flex: 1; min-width: 0; }
|
||||
.model-row__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.1rem;
|
||||
}
|
||||
.model-row__id {
|
||||
display: block;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--text-xs);
|
||||
color: var(--ink-muted);
|
||||
color: var(--ink-faint);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
}
|
||||
.model-row__actions { display: flex; gap: var(--sp-1); flex: none; align-items: center; }
|
||||
.model-row__actions { display: flex; align-items: center; gap: var(--sp-1); flex: none; }
|
||||
|
||||
/* --- Permission and checkbox grids ---------------------------------------- */
|
||||
.model-list { list-style: none; margin: 0; padding: 0; }
|
||||
.model-list__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--sp-3);
|
||||
padding: var(--sp-3) 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.model-list__item:first-child { padding-top: 0; }
|
||||
.model-list__item:last-child { border-bottom: 0; padding-bottom: 0; }
|
||||
|
||||
/* --- Permission grids ------------------------------------------------------ */
|
||||
.checkbox-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -159,26 +235,52 @@
|
||||
|
||||
.perm-row {
|
||||
align-items: flex-start;
|
||||
padding: var(--sp-2) 0;
|
||||
padding: var(--sp-3) 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.perm-row:last-child { border-bottom: 0; }
|
||||
.perm-row input { margin-top: 0.2rem; }
|
||||
.perm-row input { margin-top: 0.15rem; }
|
||||
.perm-row__desc {
|
||||
display: block;
|
||||
font-size: var(--text-xs);
|
||||
color: var(--ink-faint);
|
||||
font-weight: 400;
|
||||
line-height: var(--leading-normal);
|
||||
margin-top: 0.1rem;
|
||||
}
|
||||
|
||||
.input--file {
|
||||
padding: 0.35rem;
|
||||
.perm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
|
||||
.perm-list__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
.perm-list__state {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--surface-active);
|
||||
color: var(--ink-faint);
|
||||
flex: none;
|
||||
}
|
||||
.perm-list__state.is-on { background: var(--success-soft); color: var(--success); }
|
||||
|
||||
/* --- Misc ------------------------------------------------------------------ */
|
||||
.input--file {
|
||||
height: auto;
|
||||
padding: 0.35rem;
|
||||
font-size: var(--text-xs);
|
||||
background: var(--surface-raised);
|
||||
}
|
||||
|
||||
.field__hint code {
|
||||
.nav-item.is-disabled { opacity: 0.4; cursor: default; }
|
||||
.nav-item.is-disabled:hover { background: none; color: var(--ink-muted); }
|
||||
|
||||
.field__hint code,
|
||||
.card__lede code {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.92em;
|
||||
padding: 0.05em 0.3em;
|
||||
|
||||
Reference in New Issue
Block a user