- Simplified to 3 clear sections: 1. OpenCode Models: OpenCode dropdown + display name + order buttons 2. OpenCode Chain: Fallback chain with add form + order buttons 3. Public Models: Manual entry + order buttons (completely separate) - New state variables: opencodeModels, opencodeChain, publicModels - Clean API endpoints for chain operations - Removed all confusing legacy code and naming
251 lines
10 KiB
HTML
251 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Admin Panel</title>
|
|
<link rel="stylesheet" href="/styles.css" />
|
|
<style>
|
|
/* Build page uses a single-column admin layout for clarity */
|
|
body[data-page="build"] .admin-grid {
|
|
grid-template-columns: none !important;
|
|
gap: 12px !important;
|
|
}
|
|
body[data-page="build"] .admin-grid .admin-card {
|
|
width: 100% !important;
|
|
}
|
|
/* Slightly tighten cards on the build page */
|
|
body[data-page="build"] .admin-card { padding: 12px; }
|
|
</style>
|
|
|
|
<!-- PostHog Analytics -->
|
|
<script src="/posthog.js"></script>
|
|
</head>
|
|
<body data-page="build">
|
|
<div class="sidebar-overlay"></div>
|
|
<div class="app-shell">
|
|
<aside class="sidebar">
|
|
<div class="brand">
|
|
<div class="brand-mark">A</div>
|
|
<div>
|
|
<div class="brand-title">Admin</div>
|
|
<div class="brand-sub">Site management</div>
|
|
</div>
|
|
<button id="close-sidebar" class="ghost" style="margin-left: auto; display: none;">×</button>
|
|
</div>
|
|
<div class="sidebar-section">
|
|
<div class="section-heading">Navigation</div>
|
|
<a class="ghost" href="/admin/build">Build models</a>
|
|
<a class="ghost" href="/admin/plan">Plan models</a>
|
|
<a class="ghost" href="/admin/plans">Plans</a>
|
|
<a class="ghost" href="/admin/accounts">Accounts</a>
|
|
<a class="ghost" href="/admin/affiliates">Affiliates</a>
|
|
<a class="ghost" href="/admin/withdrawals">Withdrawals</a>
|
|
<a class="ghost" href="/admin/tracking">Tracking</a>
|
|
<a class="ghost" href="/admin/resources">Resources</a>
|
|
<a class="ghost" href="/admin/external-testing">External Testing</a>
|
|
<a class="ghost" href="/admin/contact-messages">Contact Messages</a>
|
|
<a class="ghost" href="/admin/feature-requests">Feature Requests</a>
|
|
<a class="ghost" href="/admin/blogs">Blog Management</a>
|
|
<a class="ghost" href="/admin/login">Login</a>
|
|
</div>
|
|
</aside>
|
|
<main class="main">
|
|
<div class="admin-shell">
|
|
<div class="topbar" style="margin-bottom: 12px;">
|
|
<button id="menu-toggle">
|
|
<span></span><span></span><span></span>
|
|
</button>
|
|
<div>
|
|
<div class="pill">Admin</div>
|
|
<div class="title" style="margin-top: 6px;">Model Control</div>
|
|
<div class="crumb">Only the configured admin can sign in here.</div>
|
|
</div>
|
|
<div class="admin-actions">
|
|
<button id="admin-refresh" class="ghost">Refresh</button>
|
|
<button id="admin-logout" class="primary">Logout</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 1: OpenCode Models -->
|
|
<div class="admin-card">
|
|
<header>
|
|
<h3>OpenCode Models</h3>
|
|
<div class="pill">Backend</div>
|
|
</header>
|
|
<p style="margin-top:0; color: var(--muted);">Add models from OpenCode. These models process requests and use the OpenCode Chain below for fallback when rate limits are reached.</p>
|
|
|
|
<!-- Add Form -->
|
|
<form id="opencode-model-form" class="admin-form" style="margin-bottom: 24px;">
|
|
<label>
|
|
Choose from OpenCode
|
|
<select id="opencode-model-select"></select>
|
|
</label>
|
|
<label>
|
|
Display name
|
|
<input id="opencode-model-label" type="text" placeholder="e.g., GPT-4 Turbo" required />
|
|
</label>
|
|
<div class="admin-grid" style="grid-template-columns: 1fr 1fr; gap: 12px;">
|
|
<label>
|
|
Tier
|
|
<select id="opencode-model-tier">
|
|
<option value="free">Free (1x)</option>
|
|
<option value="plus">Plus (2x)</option>
|
|
<option value="pro">Pro (3x)</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
Icon
|
|
<select id="opencode-model-icon">
|
|
<option value="">No icon</option>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<label style="display: flex; align-items: center; gap: 8px; margin-top: 8px;">
|
|
<input id="opencode-model-media" type="checkbox" style="width: auto;" />
|
|
<span>Supports image uploads</span>
|
|
</label>
|
|
<div class="admin-actions">
|
|
<button type="submit" class="primary">Add OpenCode Model</button>
|
|
<button type="button" id="reload-opencode-models" class="ghost">Reload Models</button>
|
|
</div>
|
|
<div class="status-line" id="opencode-model-status"></div>
|
|
</form>
|
|
|
|
<!-- List -->
|
|
<header style="margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px;">
|
|
<h3>OpenCode Models List</h3>
|
|
<div class="pill" id="opencode-models-count">0</div>
|
|
</header>
|
|
<p class="muted" style="margin-top:0;">Arrange the order below. This controls which model is primary for OpenCode requests.</p>
|
|
<div id="opencode-models-list" class="admin-list"></div>
|
|
</div>
|
|
|
|
<!-- Section 2: OpenCode Chain (Fallback) -->
|
|
<div class="admin-card" style="margin-top: 16px;">
|
|
<header>
|
|
<h3>OpenCode Chain</h3>
|
|
<div class="pill">Fallback</div>
|
|
</header>
|
|
<p style="margin-top:0; color: var(--muted);">When rate limits are reached or errors occur, the system falls back through this chain of providers.</p>
|
|
|
|
<!-- Add Form -->
|
|
<form id="chain-form" class="admin-form" style="margin-bottom: 24px;">
|
|
<div class="admin-grid" style="grid-template-columns: 1fr 2fr; gap: 12px;">
|
|
<label>
|
|
Provider
|
|
<select id="chain-provider">
|
|
<option value="openrouter">OpenRouter</option>
|
|
<option value="mistral">Mistral</option>
|
|
<option value="google">Google</option>
|
|
<option value="groq">Groq</option>
|
|
<option value="nvidia">NVIDIA</option>
|
|
<option value="chutes">Chutes</option>
|
|
<option value="cerebras">Cerebras</option>
|
|
<option value="ollama">Ollama</option>
|
|
<option value="cohere">Cohere</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
Model ID
|
|
<input id="chain-model" type="text" placeholder="e.g., anthropic/claude-3.5-sonnet" required />
|
|
</label>
|
|
</div>
|
|
<div class="admin-actions">
|
|
<button type="submit" class="primary">Add to Chain</button>
|
|
</div>
|
|
<div class="status-line" id="chain-status"></div>
|
|
</form>
|
|
|
|
<!-- List -->
|
|
<header style="margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px;">
|
|
<h3>Chain Order</h3>
|
|
<div class="pill" id="chain-count">0</div>
|
|
</header>
|
|
<p class="muted" style="margin-top:0;">The system tries providers in this order. Use arrows to reorder.</p>
|
|
<div id="chain-list" class="admin-list"></div>
|
|
</div>
|
|
|
|
<!-- Section 3: Public Models (Completely Separate) -->
|
|
<div class="admin-card" style="margin-top: 16px;">
|
|
<header>
|
|
<h3>Public Models</h3>
|
|
<div class="pill">User-Facing</div>
|
|
</header>
|
|
<p style="margin-top:0; color: var(--muted);">These models are displayed to users in the builder dropdown. They are completely separate from OpenCode models.</p>
|
|
|
|
<!-- Add Form -->
|
|
<form id="public-model-form" class="admin-form" style="margin-bottom: 24px;">
|
|
<div class="admin-grid" style="grid-template-columns: 1fr 1fr; gap: 12px;">
|
|
<label>
|
|
Model ID
|
|
<input id="public-model-name" type="text" placeholder="e.g., my-custom-model" required />
|
|
</label>
|
|
<label>
|
|
Display name
|
|
<input id="public-model-label" type="text" placeholder="e.g., My Custom Model" required />
|
|
</label>
|
|
</div>
|
|
<div class="admin-grid" style="grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px;">
|
|
<label>
|
|
Tier
|
|
<select id="public-model-tier">
|
|
<option value="free">Free (1x)</option>
|
|
<option value="plus">Plus (2x)</option>
|
|
<option value="pro">Pro (3x)</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
Icon
|
|
<select id="public-model-icon">
|
|
<option value="">No icon</option>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<label style="display: flex; align-items: center; gap: 8px; margin-top: 12px;">
|
|
<input id="public-model-media" type="checkbox" style="width: auto;" />
|
|
<span>Supports image uploads</span>
|
|
</label>
|
|
<div class="admin-actions">
|
|
<button type="submit" class="primary">Add Public Model</button>
|
|
</div>
|
|
<div class="status-line" id="public-model-status"></div>
|
|
</form>
|
|
|
|
<!-- List -->
|
|
<header style="margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px;">
|
|
<h3>Public Models List</h3>
|
|
<div class="pill" id="public-models-count">0</div>
|
|
</header>
|
|
<p class="muted" style="margin-top:0;">These are shown to users. Use arrows to reorder.</p>
|
|
<div id="public-models-list" class="admin-list"></div>
|
|
</div>
|
|
|
|
<!-- Other Admin Sections -->
|
|
<div class="admin-grid" style="margin-top: 16px;">
|
|
<div class="admin-card">
|
|
<header>
|
|
<h3>System Actions</h3>
|
|
<div class="pill">Admin</div>
|
|
</header>
|
|
<p style="margin-top:0; color: var(--muted);">Emergency controls for system management.</p>
|
|
<div class="admin-actions" style="flex-direction: column; align-items: flex-start;">
|
|
<button id="cancel-all-messages" class="danger">Cancel All Running & Queued Messages</button>
|
|
<div class="status-line" id="cancel-messages-status"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-card">
|
|
<header>
|
|
<h3>Icon Library</h3>
|
|
<div class="pill">Assets</div>
|
|
</header>
|
|
<p style="margin-top:0; color: var(--muted);">Upload icon files to <strong>/chat/public/assets</strong>. PNG, JPG, SVG, and WEBP are supported.</p>
|
|
<div id="icon-list" class="admin-list"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/admin.js"></script>
|
|
</div>
|
|
</body>
|
|
</html> |