diff --git a/cortex-js/src/app.ts b/cortex-js/src/app.ts index ed7da59a6..9eb1d8d70 100644 --- a/cortex-js/src/app.ts +++ b/cortex-js/src/app.ts @@ -7,9 +7,12 @@ export const getApp = async () => { const app = await NestFactory.create(AppModule, { snapshot: true, cors: true, - logger: console + logger: console, }); + // Set the global prefix for the API /v1/ + app.setGlobalPrefix('v1'); + const fileService = app.get(FileManagerService); await fileService.getConfig(); diff --git a/cortex-js/src/infrastructure/commanders/serve.command.ts b/cortex-js/src/infrastructure/commanders/serve.command.ts index a8ade2238..42bfbc6a1 100644 --- a/cortex-js/src/infrastructure/commanders/serve.command.ts +++ b/cortex-js/src/infrastructure/commanders/serve.command.ts @@ -7,7 +7,7 @@ import { SetCommandContext } from './decorators/CommandContext'; import { ServeStopCommand } from './sub-commands/serve-stop.command'; import { ContextService } from '../services/context/context.service'; import { getApp } from '@/app'; -import { Logger } from '@nestjs/common'; +import chalk from 'chalk'; type ServeOptions = { address?: string; @@ -37,7 +37,10 @@ export class ServeCommand extends CommandRunner { const app = await getApp(); await app.listen(port, host); - console.log(`Started server at http://${host}:${port}`); + console.log(chalk.blue(`Started server at http://${host}:${port}`)); + console.log( + chalk.blue(`API Playground available at http://${host}:${port}/api`), + ); } @Option({ diff --git a/cortex-js/src/main.ts b/cortex-js/src/main.ts index 804e9481e..217b84884 100644 --- a/cortex-js/src/main.ts +++ b/cortex-js/src/main.ts @@ -3,6 +3,7 @@ import { defaultCortexJsPort, } from '@/infrastructure/constants/cortex'; import { getApp } from './app'; +import chalk from 'chalk'; async function bootstrap() { const app = await getApp(); @@ -11,8 +12,10 @@ async function bootstrap() { const port = process.env.CORTEX_JS_PORT || defaultCortexJsPort; await app.listen(port, host); - console.log(`Started server at http://${host}:${port}`); - console.log(`Swagger UI available at http://${host}:${port}/api`); + console.log(chalk.blue(`Started server at http://${host}:${port}`)); + console.log( + chalk.blue(`API Playground available at http://${host}:${port}/api`), + ); } bootstrap(); diff --git a/cortex-js/src/usecases/models/models.usecases.ts b/cortex-js/src/usecases/models/models.usecases.ts index a1615b970..30afc5815 100644 --- a/cortex-js/src/usecases/models/models.usecases.ts +++ b/cortex-js/src/usecases/models/models.usecases.ts @@ -224,7 +224,6 @@ export class ModelsUsecases { metadata: {}, }; this.eventEmitter.emit('model.event', modelEvent); - console.error('Starting model failed', e.code, e.message, e.stack); if (e.code === AxiosError.ERR_BAD_REQUEST) { return { message: 'Model already loaded',