Files
LLeMbas/src/lembas/web/templates/admin/general.html
T
Jaroslav Beneš a8b7b5fc14 Fix the settings tabs, and space a form from what follows it
**The Audio tab rendered nothing.** The tabs are radios plus sibling
selectors, and the CSS named every tab twice -- once to highlight its label,
once to show its panel. A tab added without also adding those two rules gets a
label that selects nothing, which is not something anyone catches in review; it
looks like a blank page.

Replaced with rules that derive what they can. The active label is
`input:checked + .tabs__tab`, which needs to know nothing at all. The panel is
matched by position -- CSS cannot compare a radio's id with a panel's data-tab
-- so the Nth radio shows the Nth panel. Both lists render in the same order
and a conditional tab drops out of both at once, so they cannot drift. There is
a test asserting the two orders match, including with Audio absent.

**A card following a form sat flush against Save.** The "Try it" panel on the
search page read as another field of the settings form. The gap belongs to the
form rather than to its action row: the action row is always its form's last
child, so a bottom margin there has nothing to push away from. Adds
`.form-actions` and a bottom margin on a form that is a direct child of an
admin page.

Also says plainly in the dictation settings that a server hosting one model
ignores the model field, so `whisper-1` there is a label rather than a
selection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 18:36:41 +02:00

90 lines
3.2 KiB
HTML

{% extends "admin/_layout.html" %}
{% from "_macros.html" import icon %}
{% set section = "general" %}
{% block title %}General - LLeMbas{% endblock %}
{% block heading %}General{% endblock %}
{% block admin_content %}
<p class="admin-lede">
Instance-wide settings. These are stored in the database and take effect
immediately — no restart, and they survive one.
</p>
{% if saved %}
<div class="alert alert--success">{{ icon("check", "icon--sm") }} <span>Settings saved.</span></div>
{% endif %}
<form method="post" action="/admin/general">
<section class="card">
<h2 class="card__title">Identity</h2>
<div class="field">
<label class="field__label" for="instance-name">Instance name</label>
<input class="input" id="instance-name" name="instance_name"
value="{{ values.instance_name }}" maxlength="120">
<p class="field__hint">Shown in the browser tab and on the sign-in page.</p>
</div>
</section>
<section class="card">
<h2 class="card__title">Default system prompt</h2>
<p class="card__lede">
Applied to every chat that does not have a prompt of its own. A model's
prompt overrides this, and a chat's prompt overrides both — most specific
wins outright rather than the three being stacked together.
</p>
<div class="field">
<label class="field__label visually-hidden" for="system-prompt">System prompt</label>
<textarea class="textarea" id="system-prompt" name="system_prompt" rows="5"
placeholder="You are a helpful assistant.">{{ values.system_prompt }}</textarea>
<p class="field__hint">Leave empty to send no system prompt at all.</p>
</div>
</section>
<section class="card">
<h2 class="card__title">
Registration
{% if values.allow_signup %}
<span class="badge badge--success">open</span>
{% else %}
<span class="badge badge--danger">closed</span>
{% endif %}
</h2>
<div class="field">
<label class="checkbox">
<input type="checkbox" name="allow_signup" value="true"
{{ 'checked' if values.allow_signup }}>
<span>Anyone who can reach this instance may create an account</span>
</label>
<p class="field__hint">
Turn this off once your users exist. Sign-in is unaffected — existing
accounts keep working, and the "Create one" link disappears from the
sign-in page.
</p>
</div>
{% if values.allow_signup and user_count > 0 %}
<div class="alert alert--warning">
{{ icon("warning", "alert__icon") }}
<div>
<strong>Registration is open.</strong>
<div class="text-sm" style="margin-top: var(--sp-1)">
This instance has {{ user_count }} account{{ '' if user_count == 1 else 's' }}.
Anyone who can reach it can add another, and every account can use your
configured models and API keys.
</div>
</div>
</div>
{% endif %}
<p class="field__hint">
<code>LEMBAS_ALLOW_SIGNUP</code> in the environment sets only the starting
value. Once saved here, this setting wins.
</p>
</section>
<div class="form-actions"><button class="btn btn--primary" type="submit">Save settings</button></div>
</form>
{% endblock %}