Spaces:
Sleeping
Sleeping
File size: 5,082 Bytes
d530f14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | // Application Configuration
// This file contains all configurable settings for the application
export const appConfig = {
// Vercel Sandbox Configuration
vercelSandbox: {
// Sandbox timeout in minutes
timeoutMinutes: 15,
// Convert to milliseconds for Vercel Sandbox API
get timeoutMs() {
return this.timeoutMinutes * 60 * 1000;
},
// Development server port (Vercel Sandbox typically uses 3000 for Next.js/React)
devPort: 3000,
// Time to wait for dev server to be ready (in milliseconds)
devServerStartupDelay: 7000,
// Time to wait for CSS rebuild (in milliseconds)
cssRebuildDelay: 2000,
// Working directory in sandbox
workingDirectory: '/app',
// Default runtime for sandbox
runtime: 'node22' // Available: node22, python3.13, v0-next-shadcn, cua-ubuntu-xfce
},
// E2B Sandbox Configuration
e2b: {
// Sandbox timeout in minutes
timeoutMinutes: 30,
// Convert to milliseconds for E2B API
get timeoutMs() {
return this.timeoutMinutes * 60 * 1000;
},
// Development server port (E2B uses 5173 for Vite)
vitePort: 5173,
// Time to wait for Vite dev server to be ready (in milliseconds)
viteStartupDelay: 10000,
// Working directory in sandbox
workingDirectory: '/home/user/app',
},
// AI Model Configuration
ai: {
// Default AI model
defaultModel: 'google/gemini-3-pro-preview',
// Available models
availableModels: [
'openai/gpt-5',
'moonshotai/kimi-k2-instruct-0905',
'anthropic/claude-sonnet-4-20250514',
'google/gemini-3-pro-preview'
],
// Model display names
modelDisplayNames: {
'openai/gpt-5': 'GPT-5',
'moonshotai/kimi-k2-instruct-0905': 'Kimi K2 (Groq)',
'anthropic/claude-sonnet-4-20250514': 'Sonnet 4',
'google/gemini-3-pro-preview': 'Gemini 3 Pro (Preview)'
} as Record<string, string>,
// Model API configuration
modelApiConfig: {
'moonshotai/kimi-k2-instruct-0905': {
provider: 'groq',
model: 'moonshotai/kimi-k2-instruct-0905'
}
},
// Temperature settings for non-reasoning models
defaultTemperature: 0.7,
// Max tokens for code generation
maxTokens: 8000,
// Max tokens for truncation recovery
truncationRecoveryMaxTokens: 4000,
},
// Code Application Configuration
codeApplication: {
// Delay after applying code before refreshing iframe (milliseconds)
defaultRefreshDelay: 2000,
// Delay when packages are installed (milliseconds)
packageInstallRefreshDelay: 5000,
// Enable/disable automatic truncation recovery
enableTruncationRecovery: false, // Disabled - too many false positives
// Maximum number of truncation recovery attempts per file
maxTruncationRecoveryAttempts: 1,
},
// UI Configuration
ui: {
// Show/hide certain UI elements
showModelSelector: true,
showStatusIndicator: true,
// Animation durations (milliseconds)
animationDuration: 200,
// Toast notification duration (milliseconds)
toastDuration: 3000,
// Maximum chat messages to keep in memory
maxChatMessages: 100,
// Maximum recent messages to send as context
maxRecentMessagesContext: 20,
},
// Development Configuration
dev: {
// Enable debug logging
enableDebugLogging: true,
// Enable performance monitoring
enablePerformanceMonitoring: false,
// Log API responses
logApiResponses: true,
},
// Package Installation Configuration
packages: {
// Use --legacy-peer-deps flag for npm install
useLegacyPeerDeps: true,
// Package installation timeout (milliseconds)
installTimeout: 60000,
// Auto-restart Vite after package installation
autoRestartVite: true,
},
// File Management Configuration
files: {
// Excluded file patterns (files to ignore)
excludePatterns: [
'node_modules/**',
'.git/**',
'.next/**',
'dist/**',
'build/**',
'*.log',
'.DS_Store'
],
// Maximum file size to read (bytes)
maxFileSize: 1024 * 1024, // 1MB
// File extensions to treat as text
textFileExtensions: [
'.js', '.jsx', '.ts', '.tsx',
'.css', '.scss', '.sass',
'.html', '.xml', '.svg',
'.json', '.yml', '.yaml',
'.md', '.txt', '.env',
'.gitignore', '.dockerignore'
],
},
// API Endpoints Configuration (for external services)
api: {
// Retry configuration
maxRetries: 3,
retryDelay: 1000, // milliseconds
// Request timeout (milliseconds)
requestTimeout: 30000,
}
};
// Type-safe config getter
export function getConfig<K extends keyof typeof appConfig>(key: K): typeof appConfig[K] {
return appConfig[key];
}
// Helper to get nested config values
export function getConfigValue(path: string): any {
return path.split('.').reduce((obj, key) => obj?.[key], appConfig as any);
}
export default appConfig; |