{"repo": "asimaftab/fusionai", "files": {"controllers/homeController.js": {"34ad26a199f0e813964c5cf8e8f3a7b2ebdfd35e": {"t": 1786068267.4435768, "n": 3410, "h": "682508b45f8f6fd9", "c": "/**\n * Home Controller\n * Handles home page and general application routes\n */\n\nconst path = require('path');\nconst { validationResult } = require('express-validator');\n\nclass HomeController {\n /**\n * Render home page with available AI models\n */\n static async index(req, res) {\n try {\n const models = [\n {\n id: 'gpt5',\n name: 'GPT-5 Chat',\n provider: 'Azure OpenAI',\n description: 'Most advanced language model from OpenAI',\n status: 'online',\n capabilities: ['text', 'file-upload', 'screenshot'],\n icon: 'fas fa-brain'\n },\n {\n id: 'deepseek',\n name: 'DeepSeek Chat',\n provider: 'DeepSeek AI',\n description: 'Advanced reasoning and coding capabilities',\n status: 'online',\n capabilities: ['text', 'file-upload'],\n icon: 'fas fa-search'\n },\n {\n id: 'grok',\n name: 'Grok-3',\n provider: 'xAI',\n description: 'Real-time information with wit and humor',\n status: 'offline',\n capabilities: ['text'],\n icon: 'fas fa-robot'\n },\n {\n id: 'image-gen',\n name: 'Image Generation',\n provider: 'Azure OpenAI',\n description: 'Create stunning images from text descriptions',\n status: 'online',\n capabilities: ['text-to-image'],\n icon: 'fas fa-image'\n }\n ];\n\n res.render('index', { \n title: 'FusionAI - Multiple AI Models Access',\n models,\n year: new Date().getFullYear()\n });\n } catch (error) {\n console.error('Error rendering home page:', error);\n res.status(500).render('error', { \n error: 'Internal Server Error',\n message: 'Something went wrong loading the home page'\n });\n }\n }\n\n /**\n * Health check endpoint\n */\n static async healthCheck(req, res) {\n res.json({\n status: 'healthy',\n timestamp: new Date().toISOString(),\n uptime: process.uptime(),\n version: process.env.npm_package_version || '1.0.0'\n });\n }\n\n /**\n * Configuration check endpoint\n */\n static async configCheck(req, res) {\n const config = {\n azure_openai: !!process.env.AZURE_OPENAI_API_KEY,\n deepseek: !!process.env.DEEPSEEK_API_KEY,\n grok: !!process.env.GROK_API_KEY,\n port: process.env.PORT || 3001,\n environment: process.env.NODE_ENV || 'development'\n };\n\n res.json({\n configured: config,\n timestamp: new Date().toISOString()\n });\n }\n\n /**\n * 404 Error handler\n */\n static notFound(req, res) {\n res.status(404).render('404', {\n title: 'Page Not Found',\n message: `The page \"${req.originalUrl}\" could not be found.`\n });\n }\n}\n\nmodule.exports = HomeController;\n"}}}}