AI gateway: - Add a generic, admin-selectable `client_profile` field on gateway_providers (e.g. "opencode") so a provider needing special request headers (OpenCode Zen's client-identity spoofing) is configured like any other provider, not hardcoded by name. - Track per-(provider, model) reliability/speed/latency health in memory, seeded from the existing gateway_usage_ledger at startup - purely observational, never influences routing. - New Stats tab on /admin/gateway: request volume, latency, per-model breakdowns, and reliability weight, charted with a vendored Chart.js and devplace's own theme tokens. - Record which model a failed request actually fell back to (fallback_used_route), surfaced in the Recent Failures table. - Stop excluding context_length errors from fallback, and skip a primary attempt outright when its known context window is already too small for the estimated request size, going straight to the fallback. - gateway_usage_ledger's provider/fallback_used_route columns and indexes are ensured centrally in database/schema.py's init_db(), the single point of truth for this table's schema. - Non-OpenAI upstream routing and client-model passthrough; trust only the upstream's own X-Gateway-Model header for served-model attribution. Devii agent: - Fix a real lockup: plan/verify tools could be individually disabled via the admin tool toggles while still being required by the protocol gate, permanently bricking any task that needed tools. They can no longer be disabled, and the gate now also checks the tool is actually offered. - Fix compaction being silently calibrated for a 1M-token model while running a much smaller one: context budget is now percentage-based and the summarizer's own request is sized to fit the real model. - Give a specific, actionable retry message when plan()'s own arguments get cut off by the output limit, and tighten its schema to discourage overlong plans. Other: - Backup service: offload completed backups to a remote Hetzner Storage Box. - Container manager: fix orphan blob leaks from sync races, add a two-phase plan/execute `system prune` CLI command. - Admin gateway UI: replace the JS-rendered model/provider tables with server-rendered forms and pages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DhmEkvutuwtzFVcLbTrhdo
70 lines
3.8 KiB
HTML
70 lines
3.8 KiB
HTML
{% extends "admin_base.html" %}
|
|
{% block extra_head %}
|
|
{{ super() }}
|
|
<link rel="stylesheet" href="{{ static_url('/static/css/gateway.css') }}">
|
|
{% endblock %}
|
|
{% block admin_content %}
|
|
<div class="admin-toolbar">
|
|
<h2>{{ "Edit quota rule" if is_edit else "Add quota rule" }}</h2>
|
|
<a class="admin-btn admin-btn-sm" href="/admin/gateway?tab=quota">← Back to quota rules</a>
|
|
</div>
|
|
|
|
{% if error %}
|
|
<p class="gw-error" role="alert">{{ error }}</p>
|
|
{% endif %}
|
|
|
|
<form method="post" action="{{ '/admin/gateway/quota-rules/' + uid + '/edit' if is_edit else '/admin/gateway/quota-rules/new' }}" class="gw-page-form" role="group" aria-label="{{ 'Edit quota rule' if is_edit else 'Add quota rule' }}">
|
|
<fieldset class="gw-fieldset">
|
|
<legend>Scope</legend>
|
|
<p class="gw-section-hint">At least one of role, user, or app reference is required. Leaving a dimension blank makes it a wildcard, pooling spend across everyone matching the remaining dimensions.</p>
|
|
<div class="gw-field-grid">
|
|
<div class="gw-field">
|
|
<label for="gw-quota-owner-kind">Role</label>
|
|
<select id="gw-quota-owner-kind" name="owner_kind">
|
|
<option value="" {% if not form.owner_kind %}selected{% endif %}>any</option>
|
|
<option value="user" {% if form.owner_kind == "user" %}selected{% endif %}>member</option>
|
|
<option value="admin" {% if form.owner_kind == "admin" %}selected{% endif %}>admin</option>
|
|
<option value="anonymous" {% if form.owner_kind == "anonymous" %}selected{% endif %}>guest (unauthenticated)</option>
|
|
<option value="internal" {% if form.owner_kind == "internal" %}selected{% endif %}>internal (DevPlace's own services)</option>
|
|
<option value="key" {% if form.owner_kind == "key" %}selected{% endif %}>static access key</option>
|
|
</select>
|
|
</div>
|
|
<div class="gw-field">
|
|
<label for="gw-quota-owner-id">Specific user uid</label>
|
|
<input type="text" id="gw-quota-owner-id" name="owner_id" placeholder="(optional) exact uid, blank = any" value="{{ form.owner_id }}">
|
|
</div>
|
|
<div class="gw-field">
|
|
<label for="gw-quota-app-reference">App reference</label>
|
|
<input type="text" id="gw-quota-app-reference" name="app_reference" placeholder="(optional) devplace-bots-v-1-0-0, blank = any" value="{{ form.app_reference }}">
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<fieldset class="gw-fieldset">
|
|
<legend>Limit</legend>
|
|
<div class="gw-field-grid">
|
|
<div class="gw-field">
|
|
<label for="gw-quota-limit">Limit / 24h ($)</label>
|
|
<input type="number" id="gw-quota-limit" name="limit_usd" min="0" step="0.01" value="{{ form.limit_usd }}" title="0 = unlimited">
|
|
</div>
|
|
<div class="gw-field">
|
|
<label for="gw-quota-active">Active</label>
|
|
<select id="gw-quota-active" name="is_active">
|
|
<option value="1" {% if form.is_active == "1" %}selected{% endif %}>Yes</option>
|
|
<option value="0" {% if form.is_active == "0" %}selected{% endif %}>No</option>
|
|
</select>
|
|
</div>
|
|
<div class="gw-field">
|
|
<label for="gw-quota-label">Label</label>
|
|
<input type="text" id="gw-quota-label" name="label" placeholder="(optional) admin note" maxlength="200" value="{{ form.label }}">
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div class="gw-page-actions">
|
|
<button type="submit" class="admin-btn admin-btn-primary">{{ "Save quota rule" if is_edit else "Add quota rule" }}</button>
|
|
<a class="admin-btn admin-btn-sm" href="/admin/gateway?tab=quota">Cancel</a>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|