From 19b3b5151abdcd74aa311884d2370bc17b6a64db Mon Sep 17 00:00:00 2001 From: marknguyen1302 Date: Wed, 29 May 2024 10:56:09 +0700 Subject: [PATCH 1/2] chore: add wildcard matching for models endpoints --- cortex-js/package.json | 3 ++- .../infrastructure/controllers/models.controller.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cortex-js/package.json b/cortex-js/package.json index 6515ebe62..7267d22a0 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -25,7 +25,8 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "typeorm": "typeorm-ts-node-esm" + "typeorm": "typeorm-ts-node-esm", + "build:local": "npx nest build && chmod +x ./dist/src/command.js && npm link" }, "dependencies": { "@huggingface/gguf": "^0.1.5", diff --git a/cortex-js/src/infrastructure/controllers/models.controller.ts b/cortex-js/src/infrastructure/controllers/models.controller.ts index 18a54c5d8..1f8b17e30 100644 --- a/cortex-js/src/infrastructure/controllers/models.controller.ts +++ b/cortex-js/src/infrastructure/controllers/models.controller.ts @@ -57,7 +57,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Post(':modelId/start') + @Post(':modelId(*)/start') startModel( @Param('modelId') modelId: string, @Body() settings: ModelSettingParamsDto, @@ -80,7 +80,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Post(':modelId/stop') + @Post(':modelId(*)/stop') stopModel(@Param('modelId') modelId: string) { return this.modelsUsecases.stopModel(modelId); } @@ -100,7 +100,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Get('download/:modelId') + @Get('download/:modelId(*)') downloadModel(@Param('modelId') modelId: string) { return this.modelsUsecases.downloadModel(modelId); } @@ -137,7 +137,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Get(':id') + @Get(':id(*)') findOne(@Param('id') id: string) { return this.modelsUsecases.findOne(id); } @@ -157,7 +157,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Patch(':id') + @Patch(':id(*)') update(@Param('id') id: string, @Body() updateModelDto: UpdateModelDto) { return this.modelsUsecases.update(id, updateModelDto); } @@ -177,7 +177,7 @@ export class ModelsController { required: true, description: 'The unique identifier of the model.', }) - @Delete(':id') + @Delete(':id(*)') remove(@Param('id') id: string) { return this.modelsUsecases.remove(id); } From e2df310da3a589081f1dbdef37d550299a359989 Mon Sep 17 00:00:00 2001 From: marknguyen1302 Date: Wed, 29 May 2024 11:01:39 +0700 Subject: [PATCH 2/2] Change build dev command name --- cortex-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex-js/package.json b/cortex-js/package.json index 7267d22a0..dec85c2ea 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -26,7 +26,7 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", "typeorm": "typeorm-ts-node-esm", - "build:local": "npx nest build && chmod +x ./dist/src/command.js && npm link" + "build:dev": "npx nest build && chmod +x ./dist/src/command.js && npm link" }, "dependencies": { "@huggingface/gguf": "^0.1.5",