UNPKG

skailan-ai

Version:

Servicio de IA y procesamiento de lenguaje natural para Skailan

42 lines 1.64 kB
import express from 'express'; import { tenantResolver } from '@skailan/core/dist/shared/middlewares/tenantResolver'; import promptRoutes from './api/routes/promptRoutes'; import llmConfigRoutes from './api/routes/llmConfigRoutes'; import aiRoutes from './api/routes/aiRoutes'; import sentimentRoutes from './api/routes/sentimentRoutes'; import intentRoutes from './api/routes/intentRoutes'; import contentRoutes from './api/routes/contentRoutes'; const app = express(); const PORT = process.env.PORT || 3010; // Using 3010 app.use(express.json()); app.use(tenantResolver); app.get('/', (req, res) => { res.send('AI Service API is running!'); }); app.use('/prompts', promptRoutes); app.use('/llm-configs', llmConfigRoutes); app.use('/ai', aiRoutes); app.use('/sentiment', sentimentRoutes); app.use('/intent', intentRoutes); app.use('/content', contentRoutes); app.get('/test-tenant', async (req, res) => { try { const organizationId = req.organization?.id; // Get organization ID from req.organization if (!organizationId) { return res.status(400).json({ error: 'Organization ID not found.' }); } if (req.tenantPrisma) { res.status(200).json({ message: `Tenant Prisma client initialized for organization: ${organizationId}` }); } else { res.status(500).json({ error: 'Prisma client not initialized.' }); } } catch (error) { res.status(500).json({ error: error.message || 'Error testing tenant.' }); } }); app.listen(PORT, () => { console.log(`AI Service running on port ${PORT}`); }); //# sourceMappingURL=index.js.map