Remove freePlanModel and opencodeBackupModel settings
Users now use OpenCode Models (Fallback Chain) for model selection. - Removed Auto Model for Hobby/Free Plan section from admin panel - Removed OpenCode Ultimate Backup Model section from admin panel - Updated server to use opencodeModels for free plan users - Removed backup model fallback logic (opencodeModels chain handles this)
This commit is contained in:
@@ -1542,13 +1542,11 @@ let mistralSettings = {
|
||||
const PLANNING_PROVIDERS = ['openrouter', 'mistral', 'google', 'groq', 'nvidia', 'ollama', 'cohere', 'kilo'];
|
||||
let planSettings = {
|
||||
provider: 'openrouter', // legacy field, retained for backwards compatibility
|
||||
freePlanModel: '',
|
||||
planningChain: [], // [{ provider, model }]
|
||||
};
|
||||
let providerLimits = {
|
||||
limits: {},
|
||||
modelProviders: {},
|
||||
opencodeBackupModel: '',
|
||||
};
|
||||
let pendingProviderPersistTimer = null;
|
||||
let providerUsage = {};
|
||||
@@ -4927,10 +4925,8 @@ function resolvePlanModel(plan, requestedModel) {
|
||||
|
||||
const candidateList = getConfiguredModels();
|
||||
|
||||
// For hobby/free plan users, use the admin-configured auto model
|
||||
// For hobby/free plan users, use the first model from the fallback chain
|
||||
if (normalized === 'hobby') {
|
||||
const adminDefault = (planSettings.freePlanModel || '').trim();
|
||||
if (adminDefault) return adminDefault;
|
||||
const firstModel = candidateList[0];
|
||||
if (firstModel) return firstModel.name;
|
||||
return resolveFallbackModel();
|
||||
@@ -5890,9 +5886,6 @@ async function loadPlanSettings() {
|
||||
if (typeof parsed.provider === 'string' && PLANNING_PROVIDERS.includes(normalizeProviderName(parsed.provider))) {
|
||||
planSettings.provider = normalizeProviderName(parsed.provider);
|
||||
}
|
||||
if (typeof parsed.freePlanModel === 'string') {
|
||||
planSettings.freePlanModel = parsed.freePlanModel.trim();
|
||||
}
|
||||
if (Array.isArray(parsed.planningChain)) {
|
||||
planSettings.planningChain = normalizePlanningChain(parsed.planningChain);
|
||||
}
|
||||
@@ -6178,7 +6171,6 @@ async function loadProviderLimits() {
|
||||
}
|
||||
|
||||
collectProviderSeeds().forEach((p) => ensureProviderLimitDefaults(p));
|
||||
if (!providerLimits.opencodeBackupModel) providerLimits.opencodeBackupModel = '';
|
||||
}
|
||||
|
||||
async function persistProviderLimits() {
|
||||
@@ -8764,16 +8756,6 @@ function buildPlanModelChain() {
|
||||
const chain = normalizePlanningChain(planSettings.planningChain);
|
||||
if (chain.length) return chain;
|
||||
|
||||
// Check if freePlanModel has a provider prefix (e.g., "groq/compound-mini")
|
||||
const freePlanModel = (planSettings.freePlanModel || '').trim();
|
||||
if (freePlanModel) {
|
||||
const parsed = parseModelString(freePlanModel);
|
||||
if (parsed.provider) {
|
||||
// User specified a provider prefix, use it directly
|
||||
return [{ provider: parsed.provider, model: parsed.model }];
|
||||
}
|
||||
}
|
||||
|
||||
return defaultPlanningChainFromSettings(planSettings.provider);
|
||||
}
|
||||
|
||||
@@ -10893,16 +10875,6 @@ async function sendToOpencodeWithFallback({ session, model, content, message, cl
|
||||
if (result) return result;
|
||||
}
|
||||
|
||||
const backupModel = (providerLimits.opencodeBackupModel || '').trim();
|
||||
if (backupModel) {
|
||||
const backupChain = buildOpencodeAttemptChain(cliName, backupModel);
|
||||
for (const option of backupChain) {
|
||||
const result = await tryOption(option, true);
|
||||
if (result instanceof Error) break;
|
||||
if (result) return result;
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_EARLY_TERMINATIONS = 2;
|
||||
const recentEarlyTerminations = attempts.filter(
|
||||
a => a.earlyTermination &&
|
||||
@@ -16054,9 +16026,6 @@ async function handleAdminPlanSettingsPost(req, res) {
|
||||
if (Array.isArray(body.planningChain)) {
|
||||
planSettings.planningChain = normalizePlanningChain(body.planningChain);
|
||||
}
|
||||
if (typeof body.freePlanModel === 'string') {
|
||||
planSettings.freePlanModel = body.freePlanModel.trim();
|
||||
}
|
||||
if (!planSettings.planningChain.length) {
|
||||
planSettings.planningChain = defaultPlanningChainFromSettings(planSettings.provider);
|
||||
}
|
||||
@@ -16142,7 +16111,6 @@ async function handleAdminProviderLimitsGet(req, res) {
|
||||
sendJson(res, 200, {
|
||||
limits: providerLimits.limits,
|
||||
usage: snapshot,
|
||||
opencodeBackupModel: providerLimits.opencodeBackupModel || '',
|
||||
providers: discovery.providers,
|
||||
providerModels: discovery.providerModels,
|
||||
});
|
||||
@@ -16168,17 +16136,12 @@ async function handleAdminProviderLimitsPost(req, res) {
|
||||
if (body[field] !== undefined) target[field] = sanitizeLimitNumber(body[field]);
|
||||
});
|
||||
|
||||
if (typeof body.opencodeBackupModel === 'string') {
|
||||
providerLimits.opencodeBackupModel = body.opencodeBackupModel.trim();
|
||||
}
|
||||
|
||||
await persistProviderLimits();
|
||||
const discovery = await discoverProviderModels();
|
||||
sendJson(res, 200, {
|
||||
ok: true,
|
||||
limits: providerLimits.limits,
|
||||
usage: getProviderUsageSnapshot(discovery.providers),
|
||||
opencodeBackupModel: providerLimits.opencodeBackupModel || '',
|
||||
providers: discovery.providers,
|
||||
providerModels: discovery.providerModels,
|
||||
});
|
||||
@@ -19362,7 +19325,6 @@ async function bootstrap() {
|
||||
});
|
||||
console.log('[CONFIG] Planning Settings:', {
|
||||
provider: planSettings.provider,
|
||||
freePlanModel: planSettings.freePlanModel || 'not set',
|
||||
planningChainLength: planSettings.planningChain?.length || 0,
|
||||
planningChain: planSettings.planningChain
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user