Separate OpenCode and Public model management in admin panel
- Add OpenCode Models section with dropdown selection from available models - Add Public Models section with manual model ID input - Both sections have up/down ordering buttons for fallback chain priority - OpenCode models used for execution fallback when rate limits/errors occur - Public models displayed in builder dropdown for user selection - Remove unified provider chain in favor of two separate lists - Keep all existing functionality: Auto Model, Provider Limits, Icon Library, etc.
This commit is contained in:
@@ -68,17 +68,61 @@
|
||||
</div>
|
||||
|
||||
<div class="admin-grid">
|
||||
<!-- Public Facing Models Section -->
|
||||
<!-- OpenCode Models Section -->
|
||||
<div class="admin-card">
|
||||
<header>
|
||||
<h3>Add Public-Facing Model</h3>
|
||||
<h3>Add OpenCode Model</h3>
|
||||
<div class="pill">OpenCode</div>
|
||||
</header>
|
||||
<p style="margin-top:0; color: var(--muted);">These are the models available in OpenCode. They form the fallback chain for build execution. When rate limits are reached or errors occur, the system falls back to the next model in the list.</p>
|
||||
<form id="opencode-model-form" class="admin-form">
|
||||
<label>
|
||||
Select model from OpenCode
|
||||
<select id="opencode-model-select">
|
||||
<option value="">-- Select a model --</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Display name shown to users
|
||||
<input id="opencode-model-label" type="text" placeholder="Friendly label (e.g., Claude 3.5 Sonnet)" required />
|
||||
</label>
|
||||
<label>
|
||||
Model tier (for plan limits)
|
||||
<select id="opencode-model-tier">
|
||||
<option value="free">Free (1x multiplier)</option>
|
||||
<option value="plus">Plus (2x multiplier)</option>
|
||||
<option value="pro">Pro (3x multiplier)</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Icon (files in /assets)
|
||||
<select id="opencode-model-icon">
|
||||
<option value="">No icon</option>
|
||||
</select>
|
||||
</label>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<!-- Public Models Section -->
|
||||
<div class="admin-card">
|
||||
<header>
|
||||
<h3>Add Public Model</h3>
|
||||
<div class="pill">Public</div>
|
||||
</header>
|
||||
<p style="margin-top:0; color: var(--muted);">These models are displayed to users in the builder dropdown. They all share the same unified provider fallback chain.</p>
|
||||
<p style="margin-top:0; color: var(--muted);">These models are displayed to users in the builder dropdown for selection. This is separate from the OpenCode fallback chain.</p>
|
||||
<form id="public-model-form" class="admin-form">
|
||||
<label>
|
||||
Model ID (e.g., claude-3-5-sonnet, gpt-4o)
|
||||
<input id="public-model-name" type="text" placeholder="Model ID from OpenCode" required />
|
||||
<input id="public-model-name" type="text" placeholder="Enter model ID manually" required />
|
||||
</label>
|
||||
<label>
|
||||
Display name shown to users
|
||||
@@ -108,50 +152,26 @@
|
||||
<div class="status-line" id="public-model-status"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Provider Model Chain Section -->
|
||||
<div class="admin-card">
|
||||
<header>
|
||||
<h3>Provider Model Chain</h3>
|
||||
<div class="pill">Backend</div>
|
||||
</header>
|
||||
<p style="margin-top:0; color: var(--muted);">This is the unified fallback chain used for ALL models. When rate limits are reached or errors occur, the system automatically falls back to the next provider in this chain.</p>
|
||||
<form id="provider-chain-form" class="admin-form">
|
||||
<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="opencode">OpenCode</option>
|
||||
<option value="cohere">Cohere</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Model Name
|
||||
<input id="chain-model" type="text" placeholder="e.g., anthropic/claude-3.5-sonnet" required />
|
||||
</label>
|
||||
<div class="admin-actions">
|
||||
<button type="submit" class="primary">Add to Chain</button>
|
||||
</div>
|
||||
<div class="status-line" id="provider-chain-status"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Provider Chain List with Ordering -->
|
||||
<!-- OpenCode Models List with Ordering -->
|
||||
<div class="admin-card" style="margin-top: 16px;">
|
||||
<header>
|
||||
<h3>Unified Provider Chain Order</h3>
|
||||
<div class="pill" id="provider-chain-count">0</div>
|
||||
<h3>OpenCode Models (Fallback Chain)</h3>
|
||||
<div class="pill" id="opencode-models-count">0</div>
|
||||
</header>
|
||||
<p class="muted" style="margin-top:0;">Arrange the order of providers below. The system will try each provider in order when rate limits are reached or errors occur. The first provider is the primary.</p>
|
||||
<div id="provider-chain-list" class="admin-list"></div>
|
||||
<p class="muted" style="margin-top:0;">Arrange the order of OpenCode models below. When rate limits are reached or errors occur, the system falls back to the next model in this chain. The first model is the primary.</p>
|
||||
<div id="opencode-models-list" class="admin-list"></div>
|
||||
</div>
|
||||
|
||||
<!-- Public Models List with Ordering -->
|
||||
<div class="admin-card" style="margin-top: 16px;">
|
||||
<header>
|
||||
<h3>Public Models</h3>
|
||||
<div class="pill" id="public-models-count">0</div>
|
||||
</header>
|
||||
<p class="muted" style="margin-top:0;">These models are displayed to users in the builder dropdown. Arrange the order to set their display priority.</p>
|
||||
<div id="public-models-list" class="admin-list"></div>
|
||||
</div>
|
||||
|
||||
<div class="admin-grid" style="margin-top: 16px;">
|
||||
@@ -329,16 +349,6 @@
|
||||
<div id="provider-usage" class="admin-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Public Models List -->
|
||||
<div class="admin-card" style="margin-top: 16px;">
|
||||
<header>
|
||||
<h3>Public-Facing Models</h3>
|
||||
<div class="pill" id="configured-count">0</div>
|
||||
</header>
|
||||
<p class="muted" style="margin-top:0;">These models are displayed to users in the builder. All models use the unified provider chain above for fallback.</p>
|
||||
<div id="configured-list" class="admin-list"></div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<script src="/admin.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user