Remove separate chain concept - fallback is now determined by OpenCode models order

- Removed opencodeChain variable entirely
- Removed chain form/list from admin UI
- Fallback now uses the order of models in the OpenCode models list
- Updated buildOpencodeAttemptChain to iterate through opencodeModels
- Removed chain-related API endpoints
- Simplified to just two lists: opencodeModels and publicModels
This commit is contained in:
southseact-3d
2026-02-18 16:18:31 +00:00
parent 4bb54d38ad
commit 828a9dad41
3 changed files with 60 additions and 321 deletions

View File

@@ -16,18 +16,6 @@
}
/* 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 -->
@@ -79,13 +67,13 @@
</div>
</div>
<!-- Section 1: OpenCode Models (with integrated Chain) -->
<!-- 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 can fall back to the provider chain when rate limits are reached.</p>
<p style="margin-top:0; color: var(--muted);">Add models from OpenCode. When rate limits are reached, the system automatically falls back to the next model in the order below.</p>
<!-- Add Model Form -->
<form id="opencode-model-form" class="admin-form" style="margin-bottom: 24px;">
@@ -126,57 +114,14 @@
<!-- Models List -->
<header style="margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px;">
<h3>OpenCode Models List</h3>
<h3>OpenCode Models Order</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>
<p class="muted" style="margin-top:0;">Arrange the order below. #1 is the primary model. When it hits rate limits, the system falls back to #2, then #3, and so on.</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) -->
<!-- Section 2: Public Models -->
<div class="admin-card" style="margin-top: 16px;">
<header>
<h3>Public Models</h3>