import React from 'react'; import { motion } from 'framer-motion'; import { Switch } from '~/components/ui/Switch'; import { useSettings } from '~/lib/hooks/useSettings'; import { classNames } from '~/utils/classNames'; import { toast } from 'react-toastify'; import { PromptLibrary } from '~/lib/common/prompt-library'; import { useStore } from '@nanostores/react'; import { isEventLogsEnabled } from '~/lib/stores/settings'; interface FeatureToggle { id: string; title: string; description: string; icon: string; enabled: boolean; beta?: boolean; experimental?: boolean; tooltip?: string; } export default function FeaturesTab() { const { setEventLogs, isLocalModel, enableLocalModels, isLatestBranch, enableLatestBranch, promptId, setPromptId, autoSelectTemplate, setAutoSelectTemplate, enableContextOptimization, contextOptimizationEnabled, } = useSettings(); const eventLogs = useStore(isEventLogsEnabled); const features: FeatureToggle[] = [ { 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', }, { id: 'eventLogs', title: 'Event Logging', description: 'Enable detailed event logging and history', icon: 'i-ph:list-bullets', enabled: eventLogs, tooltip: 'Record detailed logs of system events and user actions', }, ]; const handleToggleFeature = (featureId: string, enabled: boolean) => { switch (featureId) { 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; case 'eventLogs': setEventLogs(enabled); toast.success(`Event logging ${enabled ? 'enabled' : 'disabled'}`); break; } }; return (
Customize your Bolt experience with experimental features
{feature.description}
Choose a prompt from the library to use as the system prompt