fix final

This commit is contained in:
southseact-3d
2026-02-20 19:59:26 +00:00
parent fa80a12112
commit 0921eaa307
3 changed files with 50 additions and 13 deletions

View File

@@ -47,7 +47,7 @@
<div> <div>
<div class="pill">Admin</div> <div class="pill">Admin</div>
<div class="title" style="margin-top: 6px;">Planning Control</div> <div class="title" style="margin-top: 6px;">Planning Control</div>
<div class="crumb">Fallback-ready planning across OpenRouter, Mistral, Google, Groq, and NVIDIA.</div> <div class="crumb">Fallback-ready planning across OpenRouter, Mistral, Google, Groq, NVIDIA, and DeepInfra.</div>
</div> </div>
<div class="admin-actions"> <div class="admin-actions">
<button id="admin-refresh" class="ghost">Refresh</button> <button id="admin-refresh" class="ghost">Refresh</button>

View File

@@ -1552,7 +1552,7 @@ let mistralSettings = {
backupModel2: MISTRAL_MODEL_BACKUP_2, backupModel2: MISTRAL_MODEL_BACKUP_2,
backupModel3: MISTRAL_MODEL_BACKUP_3, 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 = { let planSettings = {
provider: 'openrouter', // legacy field, retained for backwards compatibility provider: 'openrouter', // legacy field, retained for backwards compatibility
planningChain: [], // [{ provider, model }] planningChain: [], // [{ provider, model }]
@@ -6534,6 +6534,8 @@ function defaultPlanningChainFromSettings(preferredProvider) {
primaryChain = buildGooglePlanChain(); primaryChain = buildGooglePlanChain();
} else if (provider === 'nvidia') { } else if (provider === 'nvidia') {
primaryChain = buildNvidiaPlanChain(); primaryChain = buildNvidiaPlanChain();
} else if (provider === 'deepinfra') {
primaryChain = buildDeepInfraPlanChain();
} else { } else {
primaryChain = buildOpenRouterPlanChain(); primaryChain = buildOpenRouterPlanChain();
} }
@@ -6552,7 +6554,7 @@ function normalizeProviderName(name) {
return (name || '').toString().trim().toLowerCase() || 'opencode'; 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) // 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. // 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 })); 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(); const unique = new Map();
for (const m of collected) { for (const m of collected) {
const key = `${normalizedCli}:${encodeURIComponent((m.name || m.label || '').toLowerCase())}`; 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) { function parseModelString(modelString) {
// Parse a model string like "groq/compound-mini" or "compound-mini" into { provider, model } // Parse a model string like "groq/compound-mini" or "compound-mini" into { provider, model }
if (!modelString || typeof modelString !== 'string') { 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 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 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 kiloKey = process.env.KILO_API_KEY || '';
const deepinfraKey = process.env.DEEPINFRA_API_KEY || process.env.DEEPINFRA_API_TOKEN || '';
const payload = { const payload = {
GROQ: { GROQ: {
@@ -16965,6 +16983,11 @@ async function handleAdminEnvConfig(req, res) {
prefix: kiloKey ? `${kiloKey.substring(0, 8)}...` : null, prefix: kiloKey ? `${kiloKey.substring(0, 8)}...` : null,
source: kiloKey ? 'KILO_API_KEY' : 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 }); sendJson(res, 200, { ok: true, env: payload });
@@ -18156,7 +18179,12 @@ async function handleNewSession(req, res, userId) {
// Handle template loading // Handle template loading
if (body.templateId) { if (body.templateId) {
try { 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 // recursive copy function - explicitly defined here to avoid reference issues
const copyDirRecursive = async (src, dest) => { const copyDirRecursive = async (src, dest) => {
await fs.mkdir(dest, { recursive: true }); await fs.mkdir(dest, { recursive: true });

View File

@@ -4,62 +4,71 @@
"name": "Site Announcement Banners", "name": "Site Announcement Banners",
"description": "Create and manage announcement banners that display at the top of your site with scheduling capabilities. Features admin management, scheduling, and responsive design.", "description": "Create and manage announcement banners that display at the top of your site with scheduling capabilities. Features admin management, scheduling, and responsive design.",
"image": "/chat/templates/images/announcements.jpg", "image": "/chat/templates/images/announcements.jpg",
"category": "Content" "category": "Content",
"folder": "Announcements"
}, },
{ {
"id": "change-login-url", "id": "change-login-url",
"name": "Secure Login URL", "name": "Secure Login URL",
"description": "Hide your WordPress login page with a custom URL slug to improve security and prevent automated brute force attacks.", "description": "Hide your WordPress login page with a custom URL slug to improve security and prevent automated brute force attacks.",
"image": "/chat/templates/images/change-login-url.jpg", "image": "/chat/templates/images/change-login-url.jpg",
"category": "Security" "category": "Security",
"folder": "Change Login URL"
}, },
{ {
"id": "changelog", "id": "changelog",
"name": "Product Changelog Display", "name": "Product Changelog Display",
"description": "Showcase your product updates with a beautiful changelog page. Custom post type, shortcode support, and automatic page creation.", "description": "Showcase your product updates with a beautiful changelog page. Custom post type, shortcode support, and automatic page creation.",
"image": "/chat/templates/images/changelog.jpg", "image": "/chat/templates/images/changelog.jpg",
"category": "Content" "category": "Content",
"folder": "Changelog Plugin"
}, },
{ {
"id": "community-suggestions", "id": "community-suggestions",
"name": "Feature Request Board", "name": "Feature Request Board",
"description": "Let your community submit and vote on feature suggestions. Perfect for gathering user feedback and prioritizing development.", "description": "Let your community submit and vote on feature suggestions. Perfect for gathering user feedback and prioritizing development.",
"image": "/chat/templates/images/community-suggestions.jpg", "image": "/chat/templates/images/community-suggestions.jpg",
"category": "Community" "category": "Community",
"folder": "Community Suggestions"
}, },
{ {
"id": "faq-manager", "id": "faq-manager",
"name": "FAQ Page Builder", "name": "FAQ Page Builder",
"description": "Build beautiful FAQ pages with drag-and-drop reordering. Includes accordion styling, accessibility support, and automatic page creation.", "description": "Build beautiful FAQ pages with drag-and-drop reordering. Includes accordion styling, accessibility support, and automatic page creation.",
"image": "/chat/templates/images/faq-manager.jpg", "image": "/chat/templates/images/faq-manager.jpg",
"category": "Content" "category": "Content",
"folder": "FAQ Manager"
}, },
{ {
"id": "form-builder", "id": "form-builder",
"name": "Drag & Drop Form Builder", "name": "Drag & Drop Form Builder",
"description": "Create custom forms with an intuitive drag-and-drop interface. Track submissions, manage responses, and embed forms anywhere.", "description": "Create custom forms with an intuitive drag-and-drop interface. Track submissions, manage responses, and embed forms anywhere.",
"image": "/chat/templates/images/form-builder.jpg", "image": "/chat/templates/images/form-builder.jpg",
"category": "Forms" "category": "Forms",
"folder": "Form Builder"
}, },
{ {
"id": "headers-footers", "id": "headers-footers",
"name": "Header & Footer Scripts", "name": "Header & Footer Scripts",
"description": "Easily add custom code to your site's header and footer. Perfect for analytics tracking, ad pixels, and custom JavaScript.", "description": "Easily add custom code to your site's header and footer. Perfect for analytics tracking, ad pixels, and custom JavaScript.",
"image": "/chat/templates/images/headers-footers.jpg", "image": "/chat/templates/images/headers-footers.jpg",
"category": "Utilities" "category": "Utilities",
"folder": "headers and footers"
}, },
{ {
"id": "membership", "id": "membership",
"name": "Membership & Subscriptions", "name": "Membership & Subscriptions",
"description": "Monetize your content with membership plans. Stripe-powered payments, subscription management, and content access control.", "description": "Monetize your content with membership plans. Stripe-powered payments, subscription management, and content access control.",
"image": "/chat/templates/images/membership.jpg", "image": "/chat/templates/images/membership.jpg",
"category": "E-commerce" "category": "E-commerce",
"folder": "Membership"
}, },
{ {
"id": "scroll-to-top", "id": "scroll-to-top",
"name": "Back to Top Button", "name": "Back to Top Button",
"description": "Add a customizable scroll-to-top button to your site. Choose styles, colors, positions, and enable/disable on mobile devices.", "description": "Add a customizable scroll-to-top button to your site. Choose styles, colors, positions, and enable/disable on mobile devices.",
"image": "/chat/templates/images/scroll-to-top.jpg", "image": "/chat/templates/images/scroll-to-top.jpg",
"category": "Utilities" "category": "Utilities",
"folder": "scroll to bottom"
} }
] ]