Files
LLeMbas/src/lembas/web/templates/admin/_connection_row.html
T
HomerandClaude Opus 5.5 216e3a20d1 Helpers on another model, chosen by logic rather than by the model
A helper still runs on the chat's own model by default. Other models are
designated per main model -- offered to it, or by hand only -- by the
instance or, with helpers.designate, by a person. subagent_run gains a
model argument whose enum is exactly the candidates that passed two
checks: capacity (a model that serves one request at a time cannot be
its own helper; a connection that holds one model at a time cannot serve
a helper on another of its models) and the model rules. A helper on
another model takes that model's own effort and data group. The composer
gains a Helpers picker; the model page, the connection form and Settings
gain their switches and lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 17:37:53 +00:00

157 lines
7.4 KiB
HTML

{% from "_macros.html" import icon %}
{#
One connection: an editable form plus its current status.
Swapped in place by the "Test & refresh" button, so this fragment has to be
able to render on its own as well as inside the list.
#}
<section class="card connection" id="connection-{{ connection.id }}">
<form method="post" action="/admin/connections/{{ connection.id }}" class="form-grid">
<div class="card__header">
<div class="row" style="gap: var(--sp-2); min-width: 0">
<span class="status-dot {{ 'is-ok' if connection.enabled and not connection.last_error
else 'is-bad' if connection.last_error else 'is-off' }}"
aria-hidden="true"></span>
<strong class="truncate">{{ connection.name }}</strong>
{% if model_count is defined %}
<span class="badge">{{ model_count }} model{{ '' if model_count == 1 else 's' }}</span>
{% endif %}
{% if not connection.enabled %}
<span class="badge">{{ t("disabled") }}</span>
{% endif %}
</div>
<div class="btn-row">
<button class="btn btn--sm" type="submit"
hx-post="/admin/connections/{{ connection.id }}/test"
hx-target="#connection-{{ connection.id }}" hx-swap="outerHTML"
formnovalidate>
{{ icon("refresh", "icon--sm") }} Test &amp; refresh
</button>
<button class="btn btn--sm btn--primary" type="submit">{{ t("Save") }}</button>
</div>
</div>
{% if message %}
<div class="alert alert--{{ message_kind|default('success') }}">
{% if message_kind == "error" %}{{ icon("warning", "alert__icon") }}{% endif %}
<span>{{ message }}</span>
</div>
{% elif connection.last_error %}
<div class="alert alert--error">
{{ icon("warning", "alert__icon") }}
<span>{{ connection.last_error }}</span>
</div>
{% endif %}
<div class="field">
<label class="field__label" for="name-{{ connection.id }}">{{ t("Name") }}</label>
<input class="input" id="name-{{ connection.id }}" name="name"
value="{{ connection.name }}" required>
</div>
<div class="field">
<label class="field__label" for="url-{{ connection.id }}">{{ t("Base URL") }}</label>
<input class="input input--mono" id="url-{{ connection.id }}" name="base_url"
value="{{ connection.base_url }}" required>
</div>
<div class="field">
<label class="field__label" for="key-{{ connection.id }}">{{ t("API key") }}</label>
<input class="input input--mono" id="key-{{ connection.id }}" name="api_key"
type="password" autocomplete="off"
value="{{ unchanged if connection.api_key_encrypted else '' }}"
placeholder="{{ t('No key set') }}">
<p class="field__hint">
{% if connection.api_key_encrypted %}
Currently <code>{{ masked }}</code>. Leave the dots alone to keep it,
or clear the field to remove the key entirely.
{% else %}
No key is stored for this endpoint.
{% endif %}
</p>
</div>
{# Which data group this provider reads. Only worth a control once there is a
second group to choose; until then every connection is in the default one
and the field would be a select with one option. #}
{% if data_group_choices is defined and data_group_choices|length > 1 %}
<div class="field">
<label class="field__label" for="group-{{ connection.id }}">{{ t("Data group") }}</label>
<select class="select" id="group-{{ connection.id }}" name="data_group_id">
{% for group in data_group_choices %}
<option value="{{ group.id }}"
{{ 'selected' if (connection.data_group_id or 'default') == group.id }}>{{ group.name }}</option>
{% endfor %}
</select>
<p class="field__hint">{{ t("Its models read only this group's memories, notes, skills, knowledge and reports, and a chat started on one of them stays in it. Moving a connection does not move any data: it starts reading the other group.") }}</p>
</div>
{% endif %}
<div class="field">
<label class="field__label" for="unload-{{ connection.id }}">{{ t("Unload URL") }}</label>
<div class="btn-row">
<input class="input input--mono" id="unload-{{ connection.id }}" name="unload_url"
value="{{ connection.unload_url }}" placeholder="{{ t('No unload call') }}"
style="flex: 1; min-width: 0">
<select class="select" name="unload_method" aria-label="{{ t('How to ask it to unload') }}" style="flex: none">
<option value="POST" {{ 'selected' if connection.unload_method != 'GET' }}>{{ t("POST") }}</option>
<option value="GET" {{ 'selected' if connection.unload_method == 'GET' }}>{{ t("GET") }}</option>
</select>
</div>
<p class="field__hint">
Only used by image generation's Preserve VRAM, to free this endpoint's
memory while ComfyUI works. llama-swap answers <code>GET /unload</code>.
Leave it empty for anything on another machine — its memory is not the
memory being freed, and it would be an unexplained request.
</p>
</div>
<div class="field">
<label class="field__label" for="headers-{{ connection.id }}">{{ t("Extra headers") }}</label>
<textarea class="textarea input--mono" id="headers-{{ connection.id }}"
name="extra_headers" rows="2"
placeholder="{{ t('HTTP-Referer: https://example.org') }}">{% for name, value in (connection.extra_headers_json or {}).items() %}{{ name }}: {{ value }}
{% endfor %}</textarea>
<p class="field__hint">
One <code>Name: value</code> per line, sent with every request to this
endpoint. OpenRouter reads <code>HTTP-Referer</code> and
<code>X-Title</code> and attributes your usage with them. Leave it empty
unless an endpoint has asked for something.
</p>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox" name="one_model_at_a_time" value="true"
{{ 'checked' if connection.one_model_at_a_time }}>
<span>{{ t("Holds one model at a time") }}</span>
</label>
<p class="field__hint">{{ t("Tick this for llama-swap in front of one GPU, or anything else that unloads one model to serve another. A model here may then be its own helper, but never send a helper to another model on this connection: loading it would unload the model whose reply is waiting.") }}</p>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox" name="enabled" value="true"
{{ 'checked' if connection.enabled }}>
<span>{{ t("Enabled — its models are offered in chats") }}</span>
</label>
</div>
<div class="card__footer">
<span class="text-xs faint">
{% if connection.last_checked_at %}
Last checked {{ connection.last_checked_at.strftime("%Y-%m-%d %H:%M") }} UTC
{% else %}
Never checked
{% endif %}
</span>
<button class="btn btn--sm btn--danger" type="submit"
formaction="/admin/connections/{{ connection.id }}/delete" formnovalidate
data-confirm-button="Delete the connection “{{ connection.name }}”? Existing chats keep their history.">
{{ icon("trash", "icon--sm") }} Delete
</button>
</div>
</form>
</section>