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:
southseact-3d
2026-02-18 19:49:46 +00:00
parent f2d7b48743
commit d3205dafe5
3 changed files with 503 additions and 121 deletions

View File

@@ -11320,8 +11320,9 @@ async function processMessage(sessionId, message) {
function getConfiguredModels(cliParam = 'opencode') {
const cli = normalizeCli(cliParam || 'opencode');
// Return opencode models for backwards compatibility
const mapped = opencodeModels.map((m, idx) => ({
// Return public models for user-facing dropdown selection
// These are the models displayed to users in the builder
const mapped = publicModels.map((m, idx) => ({
id: m.id,
name: m.name,
label: m.label || m.name,
@@ -11336,6 +11337,20 @@ function getConfiguredModels(cliParam = 'opencode') {
return mapped;
}
function getOpencodeModelsForExecution() {
// Return opencode models for internal fallback chain during execution
// These models are used when rate limits are reached or errors occur
return opencodeModels.map((m) => ({
id: m.id,
name: m.name,
label: m.label || m.name,
icon: m.icon || '',
tier: m.tier || 'free',
multiplier: getTierMultiplier(m.tier || 'free'),
supportsMedia: m.supportsMedia ?? false,
}));
}
async function handleModels(_req, res, cliParam = null) {
try {
const models = getConfiguredModels(cliParam || 'opencode');