Users, groups, permissions, model settings and reasoning display
Four features, plus the schema machinery they needed. **Schema sync.** The first live instance had data in it, and create_all only creates missing *tables* -- a new column silently never appeared. db/migrations.py now diffs the declared models against the database and ALTER TABLE ... ADD COLUMN for what is missing, deriving a backfill default from the column type (SQLite refuses a NOT NULL column without one, and a Python-side `default=dict` cannot be expressed in DDL). Verified against a copy of the live database: eight changes applied, all rows preserved, second run a no-op. Renames, drops and retypes are still manual and say so. **Permissions.** A flat set of named booleans: an instance baseline widened by each group the user belongs to. A group grants and never denies -- with denies, "why can this user not do X" cannot be answered without simulating every group. Admins bypass entirely, because an admin can grant it back to themselves in two clicks and pretending otherwise is theatre. Model *access* is separate: public, or granted to groups. The picker is not the boundary -- switching a chat to a model you cannot reach is a 403. **Model settings.** Ordering, pinned-first, an instance default and a per-user default, display names, descriptions, capability flags, and uploaded images. Images are stored and served locally rather than by URL: a remote URL makes every page render a request to a third party. Uploads are validated by magic number, not the declared content type, and stored under a random name. Models with no image get a generated initial whose hue is derived from the model id, so it is stable. **Reasoning display.** Streams into its own collapsible block above the answer, labelled "Thought for 14 seconds", collapsed once finished, and never replayed as context on the next turn. Two sources: the reasoning_content delta field, and <think> tags inline in content -- the latter needs a streaming splitter because the tags arrive split across chunks. Models emitting no reasoning show nothing, via a :has() rule rather than JavaScript. Verified against qwen35-9b on llama-swap: 694 reasoning events, 52 answer tokens, cleanly separated. Two bugs found and fixed while testing: - A bare `Mapped[list]` relationship is treated by SQLAlchemy as a scalar and returns None instead of []. It needs the element type. - FastAPI substitutes the default for an empty form value, so with `x: str | None = Form(None)` a submitted `x=` is indistinguishable from an absent field. That silently broke clearing a system prompt or a temperature. update_chat now reads the raw form and checks key presence. 143 tests, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,22 +31,30 @@ runtime. Clone it, `pip install -e .`, run it.
|
||||
**Working now**
|
||||
|
||||
- **Chats** — streaming replies, Markdown with server-side syntax highlighting,
|
||||
copy and regenerate, automatic chat titles
|
||||
copy and regenerate, automatic chat titles, per-chat system prompt and
|
||||
sampling settings
|
||||
- **Reasoning display** — thinking from reasoning models streams into its own
|
||||
collapsible block, labelled with how long it took, and is never replayed as
|
||||
context
|
||||
- **Folders** — arbitrarily nested, delete a folder without losing the chats
|
||||
inside it
|
||||
- **OpenAI connections** — point at OpenAI, LM Studio, vLLM, llama.cpp,
|
||||
llama-swap, Ollama or OpenRouter; models are discovered and cached
|
||||
- **Model settings** — ordering, pinned models, an instance default and a
|
||||
per-user default, custom names and descriptions, uploaded model images
|
||||
- **Users, groups & permissions** — per-group grants that union rather than
|
||||
override, and model access restricted to chosen groups
|
||||
- **Accounts** — first account becomes the administrator, argon2 password
|
||||
hashing, revocable server-side sessions, self-service password change
|
||||
hashing, revocable server-side sessions, self-service password change,
|
||||
admin-managed accounts
|
||||
- **Admin settings** — open or close registration from the UI, stored in the
|
||||
database and effective immediately
|
||||
- **Two themes** — *Moria* (dark) and *Shire* (light), switchable per user
|
||||
|
||||
**Planned**
|
||||
|
||||
Users & groups with permissions · file upload, vision and PDFs · built-in tools
|
||||
with admin settings · custom tools and MCP servers · agentic execution (local
|
||||
and over SSH) · image generation.
|
||||
File upload, vision and PDFs · built-in tools with admin settings · custom tools
|
||||
and MCP servers · agentic execution (local and over SSH) · image generation.
|
||||
|
||||
## Quick start
|
||||
|
||||
@@ -132,8 +140,10 @@ python scripts/build_artwork.py # regenerate the SVG artwork
|
||||
python scripts/fetch_vendor.py # verify vendored JS against the lockfile
|
||||
```
|
||||
|
||||
There is no migration tool. The schema is SQLite-only and created at startup,
|
||||
so changing a column on a live database is a manual job — see `CLAUDE.md`.
|
||||
There is no Alembic. The schema is SQLite-only and synchronised at startup:
|
||||
missing tables and missing columns are added automatically, so adding a field to
|
||||
a model needs nothing but a restart. Renames, drops and retypes are still manual
|
||||
— see `CLAUDE.md`.
|
||||
|
||||
## Artwork
|
||||
|
||||
|
||||
Reference in New Issue
Block a user