Files
shopify-ai-backup/chat/public/admin.html
southseact-3d 4bb54d38ad Consolidate OpenCode Chain into OpenCode Models section
- Removed separate OpenCode Chain card
- Integrated chain functionality as subsection within OpenCode Models
- Chain form and list now appear below the models list
- Added styling to distinguish the chain subsection
2026-02-18 15:28:04 +00:00

261 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; }
/* Chain section styling */
.chain-section {
margin-top: 24px;
padding-top: 16px;
border-top: 2px solid var(--border);
}
.chain-section h4 {
margin: 0 0 8px 0;
font-size: 14px;
color: var(--muted);
}
</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;">&times;</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 (with integrated Chain) -->
<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 can fall back to the provider chain when rate limits are reached.</p>
<!-- Add Model 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>
<!-- Models 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>
<!-- Chain Section (integrated) -->
<div class="chain-section">
<h4>Fallback Chain (for when rate limits are reached)</h4>
<p class="muted" style="margin-top:0; margin-bottom: 12px;">When the primary OpenCode model hits rate limits, the system falls back through these providers in order.</p>
<!-- Add to Chain Form -->
<form id="chain-form" class="admin-form" style="margin-bottom: 16px;">
<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" style="margin-top: 12px;">
<button type="submit" class="primary">Add to Fallback Chain</button>
</div>
<div class="status-line" id="chain-status"></div>
</form>
<!-- Chain List -->
<div style="margin-top: 16px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
<span class="muted">Fallback Chain Order</span>
<span class="pill" id="chain-count">0</span>
</div>
<div id="chain-list" class="admin-list"></div>
</div>
</div>
</div>
<!-- Section 2: 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>