From 86e6444ef6fda9fb139318586db84d1480703aa2 Mon Sep 17 00:00:00 2001 From: irfanpena Date: Tue, 18 Jun 2024 13:33:25 +0700 Subject: [PATCH] API: Added the description --- .../infrastructure/controllers/events.controller.ts | 10 +++++++++- .../infrastructure/controllers/process.controller.ts | 2 +- .../infrastructure/controllers/status.controller.ts | 4 ++-- cortex-js/src/main.ts | 12 ++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cortex-js/src/infrastructure/controllers/events.controller.ts b/cortex-js/src/infrastructure/controllers/events.controller.ts index 44c5516e2..996977ef5 100644 --- a/cortex-js/src/infrastructure/controllers/events.controller.ts +++ b/cortex-js/src/infrastructure/controllers/events.controller.ts @@ -13,7 +13,7 @@ import { DownloadManagerService } from '@/download-manager/download-manager.serv import { ModelsUsecases } from '@/usecases/models/models.usecases'; import { Controller, Sse } from '@nestjs/common'; import { EventEmitter2 } from '@nestjs/event-emitter'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiOperation, ApiTags } from '@nestjs/swagger'; import { Observable, combineLatest, @@ -34,6 +34,10 @@ export class EventsController { private readonly eventEmitter: EventEmitter2, ) {} + @ApiOperation({ + summary: 'Get download status', + description: "Retrieves the model's download status.", + }) @Sse('download') downloadEvent(): Observable { const latestDownloadState$: Observable = of({ @@ -60,6 +64,10 @@ export class EventsController { ).pipe(); } + @ApiOperation({ + summary: 'Get model status', + description: 'Retrieves all the available model statuses within Cortex.', + }) @Sse('model') modelEvent(): Observable { const latestModelStatus$: Observable> = of( diff --git a/cortex-js/src/infrastructure/controllers/process.controller.ts b/cortex-js/src/infrastructure/controllers/process.controller.ts index 7c8a932a7..eaf3823ad 100644 --- a/cortex-js/src/infrastructure/controllers/process.controller.ts +++ b/cortex-js/src/infrastructure/controllers/process.controller.ts @@ -8,7 +8,7 @@ export class ProcessController { @ApiOperation({ summary: 'Terminate service', - description: 'Terminate service endpoint', + description: 'Terminates the Cortex API endpoint server for the detached mode.', }) @Delete() async delete() { diff --git a/cortex-js/src/infrastructure/controllers/status.controller.ts b/cortex-js/src/infrastructure/controllers/status.controller.ts index 80116d9ea..0d89db45e 100644 --- a/cortex-js/src/infrastructure/controllers/status.controller.ts +++ b/cortex-js/src/infrastructure/controllers/status.controller.ts @@ -7,8 +7,8 @@ export class StatusController { constructor() {} @ApiOperation({ - summary: 'Health check', - description: 'Health check endpoint.', + summary: "Get health status", + description: "Retrieves the health status of your Cortex's system.", }) @HttpCode(200) @ApiResponse({ diff --git a/cortex-js/src/main.ts b/cortex-js/src/main.ts index ac3c0d243..c1bd73a91 100644 --- a/cortex-js/src/main.ts +++ b/cortex-js/src/main.ts @@ -58,6 +58,18 @@ async function bootstrap() { 'Embeddings', 'Endpoint for creating and retrieving embedding vectors from text inputs using specified models.', ) + .addTag( + 'Status', + "Endpoint for actively querying the health status of the Cortex.", + ) + .addTag( + 'Processes', + 'Endpoint for terminating the Cortex API server processes.', + ) + .addTag( + 'Events', + 'Endpoints for observing Cortex statuses through event notifications.', + ) .addServer('http://localhost:1337') .addServer('http://localhost:1337/v1') .build();