Added orchestration layer
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
require ('dotenv').config();
|
||||
const express = require('express');
|
||||
const {getEnv} = require('@nexusai/shared');
|
||||
const chatRouter = require('./routes/chat');
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
const PORT = getEnv('PORT', '3000'); // Default to 3000 if PORT is not set
|
||||
|
||||
//Service URLS - loaded from .env on each node
|
||||
const MEMORY_URL = getEnv('MEMORY_SERVICE_URL', 'http://localhost:3002');
|
||||
const INFERENCE_URL = getEnv('INFERENCE_SERVICE_URL', 'http://localhost:3001');
|
||||
const EMBEDDING_URL = getEnv('EMBEDDING_SERVICE_URL', 'http://localhost:3003');
|
||||
const PORT = getEnv('PORT', '4000'); // Default to 4000 if PORT is not set
|
||||
|
||||
// Health check endpoint
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({
|
||||
service: 'Orchestration Service',
|
||||
status: 'healthy',
|
||||
connections: {MEMORY_URL, INFERENCE_URL, EMBEDDING_URL}
|
||||
memoryService: getEnv('MEMORY_SERVICE_URL', 'http://localhost:3002'),
|
||||
embeddingService: getEnv('EMBEDDING_SERVICE_URL', 'http://localhost:3003'),
|
||||
inferenceService: getEnv('INFERENCE_SERVICE_URL', 'http://localhost:3001'),
|
||||
});
|
||||
});
|
||||
|
||||
// Start the server
|
||||
app.use('/chat', chatRouter);
|
||||
|
||||
/******* Start the server ************/
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Orchestration Service is running on port ${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user