fix final
This commit is contained in:
@@ -1552,7 +1552,7 @@ let mistralSettings = {
|
||||
backupModel2: MISTRAL_MODEL_BACKUP_2,
|
||||
backupModel3: MISTRAL_MODEL_BACKUP_3,
|
||||
};
|
||||
const PLANNING_PROVIDERS = ['openrouter', 'mistral', 'google', 'groq', 'nvidia', 'chutes', 'cerebras', 'ollama', 'cohere'];
|
||||
const PLANNING_PROVIDERS = ['openrouter', 'mistral', 'google', 'groq', 'nvidia', 'chutes', 'cerebras', 'deepinfra', 'ollama', 'cohere'];
|
||||
let planSettings = {
|
||||
provider: 'openrouter', // legacy field, retained for backwards compatibility
|
||||
planningChain: [], // [{ provider, model }]
|
||||
@@ -6534,6 +6534,8 @@ function defaultPlanningChainFromSettings(preferredProvider) {
|
||||
primaryChain = buildGooglePlanChain();
|
||||
} else if (provider === 'nvidia') {
|
||||
primaryChain = buildNvidiaPlanChain();
|
||||
} else if (provider === 'deepinfra') {
|
||||
primaryChain = buildDeepInfraPlanChain();
|
||||
} else {
|
||||
primaryChain = buildOpenRouterPlanChain();
|
||||
}
|
||||
@@ -6552,7 +6554,7 @@ function normalizeProviderName(name) {
|
||||
return (name || '').toString().trim().toLowerCase() || 'opencode';
|
||||
}
|
||||
|
||||
const KNOWN_USAGE_PROVIDERS = new Set(['openrouter', 'mistral', 'opencode', 'google', 'groq', 'nvidia', 'cohere']);
|
||||
const KNOWN_USAGE_PROVIDERS = new Set(['openrouter', 'mistral', 'opencode', 'google', 'groq', 'nvidia', 'deepinfra', 'cohere']);
|
||||
|
||||
// Treat unknown "provider" labels that are really OpenRouter model families (e.g. openai/anthropic)
|
||||
// as OpenRouter for usage + rate-limits, so admin charts roll up correctly.
|
||||
@@ -9187,6 +9189,12 @@ async function listModels(cliName = 'opencode') {
|
||||
extras.forEach((name) => addModel({ name, label: name }));
|
||||
}
|
||||
|
||||
// Add custom models not available from models.dev
|
||||
const CUSTOM_MODELS = [
|
||||
{ name: 'kilo/giga-potato', label: 'kilo/giga-potato' }
|
||||
];
|
||||
CUSTOM_MODELS.forEach((m) => addModel(m));
|
||||
|
||||
const unique = new Map();
|
||||
for (const m of collected) {
|
||||
const key = `${normalizedCli}:${encodeURIComponent((m.name || m.label || '').toLowerCase())}`;
|
||||
@@ -9341,6 +9349,15 @@ function buildNvidiaPlanChain() {
|
||||
]);
|
||||
}
|
||||
|
||||
function buildDeepInfraPlanChain() {
|
||||
// DeepInfra models
|
||||
return uniqueStrings([
|
||||
'meta-llama/Llama-3.3-70B-Instruct',
|
||||
'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo',
|
||||
'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
||||
]);
|
||||
}
|
||||
|
||||
function parseModelString(modelString) {
|
||||
// Parse a model string like "groq/compound-mini" or "compound-mini" into { provider, model }
|
||||
if (!modelString || typeof modelString !== 'string') {
|
||||
@@ -16938,6 +16955,7 @@ async function handleAdminEnvConfig(req, res) {
|
||||
const openrouterKey = process.env.OPENROUTER_API_KEY || process.env.OPENROUTER_API_TOKEN || '';
|
||||
const chutesKey = process.env.PLUGIN_COMPASS_CHUTES_API_KEY || process.env.CHUTES_API_KEY || process.env.CHUTES_API_TOKEN || '';
|
||||
const kiloKey = process.env.KILO_API_KEY || '';
|
||||
const deepinfraKey = process.env.DEEPINFRA_API_KEY || process.env.DEEPINFRA_API_TOKEN || '';
|
||||
|
||||
const payload = {
|
||||
GROQ: {
|
||||
@@ -16965,6 +16983,11 @@ async function handleAdminEnvConfig(req, res) {
|
||||
prefix: kiloKey ? `${kiloKey.substring(0, 8)}...` : null,
|
||||
source: kiloKey ? 'KILO_API_KEY' : null,
|
||||
},
|
||||
DEEPINFRA: {
|
||||
configured: !!deepinfraKey,
|
||||
prefix: deepinfraKey ? `${deepinfraKey.substring(0, 8)}...` : null,
|
||||
source: deepinfraKey ? (process.env.DEEPINFRA_API_KEY ? 'DEEPINFRA_API_KEY' : 'DEEPINFRA_API_TOKEN') : null,
|
||||
},
|
||||
};
|
||||
|
||||
sendJson(res, 200, { ok: true, env: payload });
|
||||
@@ -18156,7 +18179,12 @@ async function handleNewSession(req, res, userId) {
|
||||
// Handle template loading
|
||||
if (body.templateId) {
|
||||
try {
|
||||
const templatePath = path.join(__dirname, 'templates', sanitizeSegment(body.templateId));
|
||||
const templatesPath = path.join(__dirname, 'templates', 'templates.json');
|
||||
const templatesContent = await fs.readFile(templatesPath, 'utf-8');
|
||||
const templates = JSON.parse(templatesContent);
|
||||
const template = templates.find(t => t.id === body.templateId);
|
||||
const folderName = template?.folder || body.templateId;
|
||||
const templatePath = path.join(__dirname, 'templates', folderName);
|
||||
// recursive copy function - explicitly defined here to avoid reference issues
|
||||
const copyDirRecursive = async (src, dest) => {
|
||||
await fs.mkdir(dest, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user