GitHub Actions
Deploy from GitHub Actions (2026-03-16 04:38 UTC)
4413b85
/**
* Frontend Configuration
*
* Auto-generated from backend .env files on 2026-03-16 09:11:53
* DO NOT EDIT THIS FILE MANUALLY - your changes will be overwritten!
*
* To update configuration:
* 1. Edit the appropriate .env file (.env.development, .env.production, etc.)
* 2. Run: python scripts/build-frontend-config.py
* 3. Redeploy your frontend
*/
// Configuration for different environments
const config = {
"development": {
"API_URL": "http://smart-chatbot.local",
"DEBUG": true,
"SHOW_DEBUG_INFO": true,
"ENVIRONMENT": "development",
"CONFIDENCE_THRESHOLD": 0.3,
"DEFAULT_LANGUAGE": "en",
"REQUEST_TIMEOUT_MS": 60000,
"API_KEY": "startupDemoApiKey9351096321"
},
"production": {
"API_URL": "https://monireach88-smart-chatbot-api.hf.space",
"DEBUG": false,
"SHOW_DEBUG_INFO": false,
"ENVIRONMENT": "production",
"CONFIDENCE_THRESHOLD": 0.8,
"DEFAULT_LANGUAGE": "en",
"REQUEST_TIMEOUT_MS": 30000,
"API_KEY": "startupDemoApiKey935109632183452"
},
"staging": {
"API_URL": "",
"DEBUG": true,
"SHOW_DEBUG_INFO": true,
"ENVIRONMENT": "staging",
"CONFIDENCE_THRESHOLD": 0.8,
"DEFAULT_LANGUAGE": "en",
"REQUEST_TIMEOUT_MS": 30000,
"API_KEY": "startupDemoApiKey9351257322"
}
};
/**
* Environment Detection
* Automatically detects current environment based on hostname
*/
function detectEnvironment() {
const hostname = window.location.hostname;
// Local development
if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname.endsWith('.local')) {
return 'development';
}
// Staging (if there are staging URLs)
if (hostname.includes('staging')) {
return 'staging';
}
// Default to production for live domains
return 'production';
}
// Get current environment configuration
const currentEnvironment = detectEnvironment();
const currentConfig = config[currentEnvironment];
if (!currentConfig) {
console.error(`No configuration found for environment: ${currentEnvironment}`);
console.error('Available environments:', Object.keys(config));
// Fallback to development config
window.ChatbotConfig = config.development || {};
} else {
window.ChatbotConfig = currentConfig;
}
// Add environment info for debugging
window.ChatbotConfig.DETECTED_ENVIRONMENT = currentEnvironment;
// Debug logging (only in development)
if (currentConfig && currentConfig.DEBUG) {
console.log('🤖 Chatbot Configuration Loaded');
console.log('Environment:', currentEnvironment);
console.log('API URL:', currentConfig.API_URL);
console.log('Debug Mode:', currentConfig.DEBUG);
console.log('Full Config:', currentConfig);
}
// Export for module systems (if needed)
if (typeof module !== 'undefined' && module.exports) {
module.exports = { config, currentConfig: window.ChatbotConfig };
}