Skip to content

Commit

Permalink
chore: add wildcard matching for models endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
marknguyen1302 authored May 29, 2024
1 parent 68f84fb commit 3914778
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cortex-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:dev": "npx nest build && chmod +x ./dist/src/command.js && npm link"
},
"dependencies": {
"@huggingface/gguf": "^0.1.5",
Expand Down
12 changes: 6 additions & 6 deletions cortex-js/src/infrastructure/controllers/models.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 3914778

Please sign in to comment.