From 423cf2a4e450fcc876ee65aa12621e64d15e13e4 Mon Sep 17 00:00:00 2001 From: marknguyen1302 Date: Tue, 2 Jul 2024 13:44:50 +0700 Subject: [PATCH 1/2] fix: revert wrong change --- .../src/infrastructure/constants/cortex.ts | 2 +- .../controllers/models.controller.ts | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cortex-js/src/infrastructure/constants/cortex.ts b/cortex-js/src/infrastructure/constants/cortex.ts index 28ce267f5..cc2d3be0c 100644 --- a/cortex-js/src/infrastructure/constants/cortex.ts +++ b/cortex-js/src/infrastructure/constants/cortex.ts @@ -48,4 +48,4 @@ export const CORTEX_ENGINE_RELEASES_URL = (engine: string) => export const CUDA_DOWNLOAD_URL = 'https://catalog.jan.ai/dist/cuda-dependencies///cuda.tar.gz'; -export const telemetryServerUrl = 'http://192.168.100.30:1338'; +export const telemetryServerUrl = 'https://telemetry.jan.ai/'; diff --git a/cortex-js/src/infrastructure/controllers/models.controller.ts b/cortex-js/src/infrastructure/controllers/models.controller.ts index 742b1b4ca..dd1711d3b 100644 --- a/cortex-js/src/infrastructure/controllers/models.controller.ts +++ b/cortex-js/src/infrastructure/controllers/models.controller.ts @@ -116,14 +116,12 @@ export class ModelsController { ], }) @Get('download/:modelId(*)') - async downloadModel(@Param('modelId') modelId: string) { - await this.modelsUsecases.pullModel(modelId, false); - - - this.telemetryUsecases.addEventToQueue({ + downloadModel(@Param('modelId') modelId: string) { + this.modelsUsecases.pullModel(modelId, false).then(() => this.telemetryUsecases.addEventToQueue({ name: EventName.DOWNLOAD_MODEL, modelId, - }); + }) + ); return { message: 'Download model started successfully.', }; @@ -163,12 +161,12 @@ export class ModelsController { description: 'The unique identifier of the model.', }) @Get('pull/:modelId(*)') - async pullModel(@Param('modelId') modelId: string) { - await this.modelsUsecases.pullModel(modelId); - this.telemetryUsecases.addEventToQueue({ + pullModel(@Param('modelId') modelId: string) { + this.modelsUsecases.pullModel(modelId).then(() => this.telemetryUsecases.addEventToQueue({ name: EventName.DOWNLOAD_MODEL, modelId, - }); + }) + ); return { message: 'Download model started successfully.', }; From 5dd843dbe6096e64224b33e62a80de51251c1133 Mon Sep 17 00:00:00 2001 From: marknguyen1302 Date: Tue, 2 Jul 2024 13:49:21 +0700 Subject: [PATCH 2/2] correct telemetry server url --- cortex-js/src/infrastructure/constants/cortex.ts | 2 +- cortex-js/src/infrastructure/controllers/models.controller.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cortex-js/src/infrastructure/constants/cortex.ts b/cortex-js/src/infrastructure/constants/cortex.ts index cc2d3be0c..0f7d5b7cc 100644 --- a/cortex-js/src/infrastructure/constants/cortex.ts +++ b/cortex-js/src/infrastructure/constants/cortex.ts @@ -48,4 +48,4 @@ export const CORTEX_ENGINE_RELEASES_URL = (engine: string) => export const CUDA_DOWNLOAD_URL = 'https://catalog.jan.ai/dist/cuda-dependencies///cuda.tar.gz'; -export const telemetryServerUrl = 'https://telemetry.jan.ai/'; +export const telemetryServerUrl = 'https://telemetry.jan.ai'; diff --git a/cortex-js/src/infrastructure/controllers/models.controller.ts b/cortex-js/src/infrastructure/controllers/models.controller.ts index dd1711d3b..11fcd4f7d 100644 --- a/cortex-js/src/infrastructure/controllers/models.controller.ts +++ b/cortex-js/src/infrastructure/controllers/models.controller.ts @@ -115,6 +115,7 @@ export class ModelsController { }, ], }) + @Get('download/:modelId(*)') downloadModel(@Param('modelId') modelId: string) { this.modelsUsecases.pullModel(modelId, false).then(() => this.telemetryUsecases.addEventToQueue({