import React, { useState } from 'react'; import { Switch } from '~/components/ui/Switch'; import { PromptLibrary } from '~/lib/common/prompt-library'; import { useSettings } from '~/lib/hooks/useSettings'; import { motion, AnimatePresence } from 'framer-motion'; import { classNames } from '~/utils/classNames'; import { settingsStyles } from '~/components/settings/settings.styles'; import { toast } from 'react-toastify'; interface FeatureToggle { id: string; title: string; description: string; icon: string; enabled: boolean; beta?: boolean; experimental?: boolean; tooltip?: string; } export default function FeaturesTab() { const { debug, enableDebugMode, isLocalModel, enableLocalModels, enableEventLogs, isLatestBranch, enableLatestBranch, promptId, setPromptId, autoSelectTemplate, setAutoSelectTemplate, enableContextOptimization, contextOptimizationEnabled, } = useSettings(); const [hoveredFeature, setHoveredFeature] = useState(null); const [expandedFeature, setExpandedFeature] = useState(null); const handleToggle = (enabled: boolean) => { enableDebugMode(enabled); enableEventLogs(enabled); toast.success(`Debug features ${enabled ? 'enabled' : 'disabled'}`); }; const features: FeatureToggle[] = [ { id: 'debug', title: 'Debug Features', description: 'Enable debugging tools and detailed logging', icon: 'i-ph:bug', enabled: debug, experimental: true, tooltip: 'Access advanced debugging tools and view detailed system logs', }, { id: 'latestBranch', title: 'Use Main Branch', description: 'Check for updates against the main branch instead of stable', icon: 'i-ph:git-branch', enabled: isLatestBranch, beta: true, tooltip: 'Get the latest features and improvements before they are officially released', }, { id: 'autoTemplate', title: 'Auto Select Code Template', description: 'Let Bolt select the best starter template for your project', icon: 'i-ph:magic-wand', enabled: autoSelectTemplate, tooltip: 'Automatically choose the most suitable template based on your project type', }, { id: 'contextOptimization', title: 'Context Optimization', description: 'Optimize chat context by redacting file contents and using system prompts', icon: 'i-ph:arrows-in', enabled: contextOptimizationEnabled, tooltip: 'Improve AI responses by optimizing the context window and system prompts', }, { id: 'experimentalProviders', title: 'Experimental Providers', description: 'Enable experimental providers like Ollama, LMStudio, and OpenAILike', icon: 'i-ph:robot', enabled: isLocalModel, experimental: true, tooltip: 'Try out new AI providers and models in development', }, ]; const handleToggleFeature = (featureId: string, enabled: boolean) => { switch (featureId) { case 'debug': handleToggle(enabled); break; case 'latestBranch': enableLatestBranch(enabled); toast.success(`Main branch updates ${enabled ? 'enabled' : 'disabled'}`); break; case 'autoTemplate': setAutoSelectTemplate(enabled); toast.success(`Auto template selection ${enabled ? 'enabled' : 'disabled'}`); break; case 'contextOptimization': enableContextOptimization(enabled); toast.success(`Context optimization ${enabled ? 'enabled' : 'disabled'}`); break; case 'experimentalProviders': enableLocalModels(enabled); toast.success(`Experimental providers ${enabled ? 'enabled' : 'disabled'}`); break; } }; return (

Features

Customize your Bolt experience

{features.map((feature, index) => ( setHoveredFeature(feature.id)} onHoverEnd={() => setHoveredFeature(null)} onClick={() => setExpandedFeature(expandedFeature === feature.id ? null : feature.id)} > {hoveredFeature === feature.id && feature.tooltip && ( {feature.tooltip}
)}
{feature.beta && ( Beta )} {feature.experimental && ( Experimental )}

{feature.title}

{feature.description}

handleToggleFeature(feature.id, checked)} />
))}

Prompt Library

Choose a prompt from the library to use as the system prompt

); }