Files that outlived the chats that held them, and a page that led with its footnotes
The second audit pass. Four things, and the first two were reported. The Prompts page put a screen of variables and a screen of preview above the editor, so the tabs began two screens down and switching one had to drag the whole page to be any use -- and on a short tab it could not drag far enough, leaving the panel stranded above a screenful of nothing. Editor first, reference after, bar sticky. Custom themes were three fixed slots: fifty-seven empty colour boxes on a fresh instance and no way to make a fourth theme. One block per theme plus a blank one, colours behind a disclosure. Both measured rather than argued about -- rendered through TestClient and driven under headless Chromium, where the tab bar moved 385->642px before and does not move now, and the themes page went from 5495px to 2820px. Asking where generated images go found the other two. Deleting a chat cascades to the attachment rows and leaves every file on disk; the helper written for exactly that was called from one place, and it was not the delete button, a schedule's chat, a helper's chat or deleting an account. Underneath it, `claim` bound message_id and never chat_id, so anything picked before a chat existed kept an empty chat_id forever -- which six readers filter on, so those files were also unnamed in the prompt, unopenable in the canvas, and invisible to the one caller the cleanup had. And folders nest now. The route has handled parent_id since folders existed, with a cycle guard and a depth cap the move path never applied; the sidebar has always drawn a tree. Nothing could ask for one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,18 @@
|
||||
flex: none;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
/* Sticky where the *page* is the scroller, which is the admin layout. The
|
||||
Tools panel is longer than a screen, so without this the bar scrolls away
|
||||
and changing tab means scrolling back up to find it. Harmless on the
|
||||
settings page, where `.tabs__body` scrolls underneath a bar that never
|
||||
moves anyway.
|
||||
|
||||
It needs the opaque `background` above it already has, or the panel would
|
||||
show through. `z-index` because a panel's own cards establish stacking
|
||||
contexts and would otherwise paint over it. */
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tabs__tab {
|
||||
|
||||
@@ -123,9 +123,25 @@
|
||||
|
||||
{# --- Themes --------------------------------------------------------------- #}
|
||||
{#
|
||||
Three blocks, always rendered, so adding a theme needs no JavaScript: an empty
|
||||
id means that block is not a theme. Saving replaces the whole list, which is
|
||||
what makes removing one a matter of clearing its id.
|
||||
One block per theme that exists, plus a single blank one to add the next.
|
||||
|
||||
It used to be three blocks, always rendered, whether or not anybody had made a
|
||||
theme -- so a fresh instance opened on fifty-seven empty colour boxes under
|
||||
three identical headings, and the fourth theme was unreachable without editing
|
||||
the template. The spare-block pattern is the no-JavaScript way to do "add
|
||||
another": fill the blank one, save, and the page comes back with your theme
|
||||
and a new blank. There is no button to press and nothing to clone, which is
|
||||
why this still works with scripting off.
|
||||
|
||||
The colours live in a <details> so a block is a heading and three fields until
|
||||
you ask for them. Nineteen inputs is the right number to *offer* and the wrong
|
||||
number to *show*: everything left empty inherits from the base, so most themes
|
||||
set four or five.
|
||||
|
||||
Saving replaces the whole list, which is what makes removing one a matter of
|
||||
clearing its id -- and why the blocks may have gaps in their numbering without
|
||||
anything caring. `save_themes` skips an index with no id and counts from the
|
||||
keys it was actually sent.
|
||||
#}
|
||||
<form method="post" action="/admin/customization/themes" class="form-grid">
|
||||
<section class="card">
|
||||
@@ -138,11 +154,14 @@
|
||||
are worked out from the accent, so you do not have to.
|
||||
</p>
|
||||
|
||||
{% for index in range(3) %}
|
||||
{# The spare block is offered until the cap, so the form cannot grow without
|
||||
end and the page cannot stop offering one while there is room. #}
|
||||
{% set slots = custom_themes | length + (1 if custom_themes | length < max_themes else 0) %}
|
||||
{% for index in range(slots) %}
|
||||
{% set existing = custom_themes[index] if index < custom_themes | length else none %}
|
||||
<div class="card" style="margin-top: var(--sp-4)">
|
||||
<h3 class="section-title">
|
||||
{{ existing.label if existing else "A theme of your own" }}
|
||||
{{ existing.label or existing.id if existing else "Add a theme" }}
|
||||
</h3>
|
||||
|
||||
<div class="field-row">
|
||||
@@ -152,7 +171,11 @@
|
||||
value="{{ existing.id if existing else '' }}" maxlength="24"
|
||||
pattern="[a-z][a-z0-9-]*" placeholder="dusk">
|
||||
<p class="field__hint">
|
||||
Lowercase letters, digits and hyphens. Clear it to remove the theme.
|
||||
{% if existing %}
|
||||
Lowercase letters, digits and hyphens. Clear it to remove this theme.
|
||||
{% else %}
|
||||
Lowercase letters, digits and hyphens. Give it one to make a theme.
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -172,23 +195,42 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-row">
|
||||
{% for name, description in tokens %}
|
||||
<div class="field">
|
||||
<label class="field__label" for="theme-{{ index }}-{{ name }}">
|
||||
{{ description }}
|
||||
</label>
|
||||
<input class="input" id="theme-{{ index }}-{{ name }}"
|
||||
name="theme_{{ index }}_{{ name }}" type="text"
|
||||
value="{{ existing.tokens.get(name, '') if existing else '' }}"
|
||||
maxlength="40" placeholder="inherited"
|
||||
spellcheck="false">
|
||||
<p class="field__hint"><code>--{{ name }}</code></p>
|
||||
{# Open on a theme that has set something, so an existing override is never
|
||||
hidden behind a disclosure somebody has to know to open. #}
|
||||
<details{{ ' open' if existing and existing.tokens }}>
|
||||
<summary class="text-sm">
|
||||
Colours
|
||||
{% if existing and existing.tokens %}
|
||||
<span class="badge">{{ existing.tokens | length }} set</span>
|
||||
{% else %}
|
||||
<span class="faint">all inherited</span>
|
||||
{% endif %}
|
||||
</summary>
|
||||
<div class="field-row">
|
||||
{% for name, description in tokens %}
|
||||
<div class="field">
|
||||
<label class="field__label" for="theme-{{ index }}-{{ name }}">
|
||||
{{ description }}
|
||||
</label>
|
||||
<input class="input" id="theme-{{ index }}-{{ name }}"
|
||||
name="theme_{{ index }}_{{ name }}" type="text"
|
||||
value="{{ existing.tokens.get(name, '') if existing else '' }}"
|
||||
maxlength="40" placeholder="inherited"
|
||||
spellcheck="false">
|
||||
<p class="field__hint"><code>--{{ name }}</code></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if custom_themes | length >= max_themes %}
|
||||
<p class="field__hint" style="margin-top: var(--sp-4)">
|
||||
That is {{ max_themes }} themes, which is the limit. Clear one's id and
|
||||
save to make room for another.
|
||||
</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<div class="btn-row">
|
||||
|
||||
@@ -18,6 +18,77 @@
|
||||
<div class="alert alert--success">{{ icon("check", "icon--sm") }} <span>Prompts saved.</span></div>
|
||||
{% endif %}
|
||||
|
||||
{#
|
||||
The editor first, the reference after, and that ordering is the fix rather
|
||||
than a preference.
|
||||
|
||||
The Variables legend and the Preview both run to a screen each, and they used
|
||||
to sit *above* the tabs -- so the thing this page exists for started two
|
||||
screens down. Every tab switch then had to move the viewport to be any use,
|
||||
and `ui.js` did: it put the tab bar at the top of the scroller. On a short
|
||||
panel the scroller cannot go that far, so the browser clamped to the maximum
|
||||
and left the panel stranded above a screen of nothing, which reads as a page
|
||||
that failed to load. That is the empty space; the scrolling was the cause and
|
||||
not the cure.
|
||||
|
||||
With the tabs near the top there is nothing to scroll past: switching panels
|
||||
changes what is below the bar and leaves the bar where it is. The reference
|
||||
cards keep their place in the reading order -- after the work, where you go
|
||||
to look something up -- and the preview still watches the form through
|
||||
`hx-include`, which does not care about document order.
|
||||
#}
|
||||
<form method="post" action="/admin/prompts" id="prompt-form">
|
||||
<div class="tabs">
|
||||
<div class="tabs__bar" role="tablist">
|
||||
{% for key, label, fragments in groups %}
|
||||
<input class="visually-hidden" type="radio" name="prompts-tab"
|
||||
id="tab-{{ key }}" {{ 'checked' if loop.first }}>
|
||||
<label class="tabs__tab" for="tab-{{ key }}">{{ label }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="tabs__body">
|
||||
{% for key, label, fragments in groups %}
|
||||
<section class="tabs__panel" data-tab="tab-{{ key }}">
|
||||
{% for fragment in fragments %}
|
||||
{% with value = values[fragment.key], overridden = fragment.key in overridden %}
|
||||
{% include "admin/_prompt_field.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Length</h2>
|
||||
<div class="field">
|
||||
<label class="field__label" for="max-harness-chars">Preamble character cap</label>
|
||||
<input class="input" id="max-harness-chars" name="max_harness_chars" type="number"
|
||||
min="0" max="100000" value="{{ max_harness_chars }}">
|
||||
<p class="field__hint">
|
||||
Everything above is cut off past this. <code>0</code> means the built-in
|
||||
{{ default_harness_chars }}. It is a backstop against a large skill index
|
||||
or memory list quietly eating the context window, not a budget to tune.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn btn--primary" type="submit">Save settings</button>
|
||||
{#
|
||||
data-confirm-button, not data-confirm: this button acts on its own through
|
||||
formaction, and confirming the whole form would also catch plain Save.
|
||||
#}
|
||||
<button class="btn" type="submit" formaction="/admin/prompts/reset"
|
||||
data-confirm-button="Put every prompt back to its built-in wording? Everything you have edited here is lost."
|
||||
data-confirm-title="Restore defaults" data-confirm-label="Restore">
|
||||
Restore all defaults
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Variables</h2>
|
||||
<p class="card__lede">
|
||||
@@ -134,57 +205,6 @@
|
||||
keyup changed delay:700ms from:#prompt-form"></div>
|
||||
</section>
|
||||
|
||||
<form method="post" action="/admin/prompts" id="prompt-form">
|
||||
<div class="tabs">
|
||||
<div class="tabs__bar" role="tablist">
|
||||
{% for key, label, fragments in groups %}
|
||||
<input class="visually-hidden" type="radio" name="prompts-tab"
|
||||
id="tab-{{ key }}" {{ 'checked' if loop.first }}>
|
||||
<label class="tabs__tab" for="tab-{{ key }}">{{ label }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="tabs__body">
|
||||
{% for key, label, fragments in groups %}
|
||||
<section class="tabs__panel" data-tab="tab-{{ key }}">
|
||||
{% for fragment in fragments %}
|
||||
{% with value = values[fragment.key], overridden = fragment.key in overridden %}
|
||||
{% include "admin/_prompt_field.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Length</h2>
|
||||
<div class="field">
|
||||
<label class="field__label" for="max-harness-chars">Preamble character cap</label>
|
||||
<input class="input" id="max-harness-chars" name="max_harness_chars" type="number"
|
||||
min="0" max="100000" value="{{ max_harness_chars }}">
|
||||
<p class="field__hint">
|
||||
Everything above is cut off past this. <code>0</code> means the built-in
|
||||
{{ default_harness_chars }}. It is a backstop against a large skill index
|
||||
or memory list quietly eating the context window, not a budget to tune.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn btn--primary" type="submit">Save settings</button>
|
||||
{#
|
||||
data-confirm-button, not data-confirm: this button acts on its own through
|
||||
formaction, and confirming the whole form would also catch plain Save.
|
||||
#}
|
||||
<button class="btn" type="submit" formaction="/admin/prompts/reset"
|
||||
data-confirm-button="Put every prompt back to its built-in wording? Everything you have edited here is lost."
|
||||
data-confirm-title="Restore defaults" data-confirm-label="Restore">
|
||||
Restore all defaults
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Tool descriptions</h2>
|
||||
<p class="card__lede">
|
||||
|
||||
@@ -64,6 +64,33 @@
|
||||
For you, not for any model. It is never sent anywhere.
|
||||
</p>
|
||||
</div>
|
||||
{#
|
||||
Nesting has worked at the route since folders existed -- with a cycle
|
||||
guard and a depth cap -- and the sidebar template has always
|
||||
recursed to draw it. Nothing anywhere submitted `parent_id`, so the
|
||||
README advertised "arbitrarily nested" folders that could not be
|
||||
nested. This is that control.
|
||||
|
||||
The options are `candidate_parents`, which is the cycle guard stated
|
||||
as a list rather than as a refusal: a picker offering a move the
|
||||
route will reject is a control that looks like it works.
|
||||
#}
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-parent">Inside</label>
|
||||
<select class="select" id="folder-parent" name="parent_id">
|
||||
<option value="">Nothing — a folder at the top</option>
|
||||
{% for candidate in parents %}
|
||||
<option value="{{ candidate.id }}"
|
||||
{{ 'selected' if folder.parent_id == candidate.id }}>
|
||||
{{ candidate.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<p class="field__hint">
|
||||
A folder inside another inherits its system prompt where it has
|
||||
none of its own.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
Reference in New Issue
Block a user