Fix model sections: separate Provider Models and Public-Facing Models
- Provider Models section: restored OpenCode integration with dropdown - Public-Facing Models section: completely separate manual entry - Provider Chain section: fallback chain with up/down buttons (unchanged) - Added separate arrays: providerModels and publicModels - Added reorder support for both provider and public models - Updated server to handle providerModel type and reorder by type
This commit is contained in:
@@ -68,25 +68,25 @@
|
||||
</div>
|
||||
|
||||
<div class="admin-grid">
|
||||
<!-- Public Facing Models Section -->
|
||||
<!-- Provider Models Section (with OpenCode integration) -->
|
||||
<div class="admin-card">
|
||||
<header>
|
||||
<h3>Add Public-Facing Model</h3>
|
||||
<div class="pill">Public</div>
|
||||
<h3>Add Provider Model</h3>
|
||||
<div class="pill">OpenCode</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>
|
||||
<form id="public-model-form" class="admin-form">
|
||||
<p style="margin-top:0; color: var(--muted);">Add models from OpenCode that will be available to users. These models use the unified provider chain for fallback.</p>
|
||||
<form id="provider-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 />
|
||||
Choose a model from OpenCode
|
||||
<select id="available-models"></select>
|
||||
</label>
|
||||
<label>
|
||||
Display name shown to users
|
||||
<input id="public-model-label" type="text" placeholder="Friendly label (e.g., Claude 3.5 Sonnet)" required />
|
||||
<input id="provider-model-label" type="text" placeholder="Friendly label (e.g., Claude 3.5 Sonnet)" required />
|
||||
</label>
|
||||
<label>
|
||||
Model tier (for plan limits)
|
||||
<select id="public-model-tier">
|
||||
<select id="provider-model-tier">
|
||||
<option value="free">Free (1x multiplier)</option>
|
||||
<option value="plus">Plus (2x multiplier)</option>
|
||||
<option value="pro">Pro (3x multiplier)</option>
|
||||
@@ -94,28 +94,29 @@
|
||||
</label>
|
||||
<label>
|
||||
Icon (files in /assets)
|
||||
<select id="public-model-icon">
|
||||
<select id="provider-model-icon">
|
||||
<option value="">No icon</option>
|
||||
</select>
|
||||
</label>
|
||||
<label style="display: flex; align-items: center; gap: 8px; margin-top: 8px;">
|
||||
<input id="public-model-media" type="checkbox" style="width: auto;" />
|
||||
<input id="provider-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>
|
||||
<button type="submit" class="primary">Add Provider Model</button>
|
||||
<button type="button" id="reload-available" class="ghost">Reload available models</button>
|
||||
</div>
|
||||
<div class="status-line" id="public-model-status"></div>
|
||||
<div class="status-line" id="provider-model-status"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Provider Model Chain Section -->
|
||||
<!-- Provider Chain Add Section -->
|
||||
<div class="admin-card">
|
||||
<header>
|
||||
<h3>Provider Model Chain</h3>
|
||||
<div class="pill">Backend</div>
|
||||
<h3>Add to Provider Chain</h3>
|
||||
<div class="pill">Fallback</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>
|
||||
<p style="margin-top:0; color: var(--muted);">Add providers to the unified fallback chain. 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
|
||||
@@ -154,6 +155,55 @@
|
||||
<div id="provider-chain-list" class="admin-list"></div>
|
||||
</div>
|
||||
|
||||
<!-- Public-Facing Models Section -->
|
||||
<div class="admin-card" style="margin-top: 16px;">
|
||||
<header>
|
||||
<h3>Public-Facing Models</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 are separate from the provider models and can be used to create curated model lists for users.</p>
|
||||
<form id="public-model-form" class="admin-form" style="margin-bottom: 16px;">
|
||||
<div class="admin-grid" style="grid-template-columns: 1fr 1fr;">
|
||||
<label>
|
||||
Model ID
|
||||
<input id="public-model-name" type="text" placeholder="e.g., custom-model-1" required />
|
||||
</label>
|
||||
<label>
|
||||
Display name
|
||||
<input id="public-model-label" type="text" placeholder="Friendly label" required />
|
||||
</label>
|
||||
</div>
|
||||
<label>
|
||||
Model tier
|
||||
<select id="public-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="public-model-icon">
|
||||
<option value="">No icon</option>
|
||||
</select>
|
||||
</label>
|
||||
<label style="display: flex; align-items: center; gap: 8px; margin-top: 8px;">
|
||||
<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>
|
||||
|
||||
<header style="margin-top: 24px;">
|
||||
<h3>Public Models List</h3>
|
||||
<div class="pill" id="public-models-count">0</div>
|
||||
</header>
|
||||
<div id="public-models-list" class="admin-list"></div>
|
||||
</div>
|
||||
|
||||
<div class="admin-grid" style="margin-top: 16px;">
|
||||
<!-- Legacy Model Form (hidden but kept for compatibility) -->
|
||||
<div class="admin-card" style="display: none;">
|
||||
|
||||
Reference in New Issue
Block a user