From b5d7c601e953d563ff52c19376dd5ad15771722d Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Wed, 6 Dec 2023 12:20:40 +0900 Subject: [PATCH 1/2] fix: get requestData to any --- src/controllers/serviceController.ts | 2 +- src/service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/serviceController.ts b/src/controllers/serviceController.ts index 64c580b..fc735ab 100644 --- a/src/controllers/serviceController.ts +++ b/src/controllers/serviceController.ts @@ -71,7 +71,7 @@ export default class ServiceController { return await this.ain.getValue(creditHistoryPath) as creditHistories; } - async request(serviceName: string, requestData: string) : Promise { + async request(serviceName: string, requestData: any) : Promise { this.isRunning(serviceName); const result = await new Promise(async (resolve, reject) => { const requestKey = Date.now(); diff --git a/src/service.ts b/src/service.ts index 6caae0b..216fae7 100644 --- a/src/service.ts +++ b/src/service.ts @@ -76,7 +76,7 @@ export default class Service { * @param {string} requestData String data for request to service. * @returns {string} Response data from service. */ - async request(requestData: string) { + async request(requestData: any) { this.isLoggedIn(); return await this.serviceController.request(this.serviceName, requestData); } From e798c29c4e5d1b78762623f0b9178ec78b2ab1bf Mon Sep 17 00:00:00 2001 From: Yoojin Ko Date: Wed, 6 Dec 2023 12:21:44 +0900 Subject: [PATCH 2/2] fix: deprecated calculate cost --- src/controllers/serviceController.ts | 3 ++- src/service.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controllers/serviceController.ts b/src/controllers/serviceController.ts index fc735ab..1c97646 100644 --- a/src/controllers/serviceController.ts +++ b/src/controllers/serviceController.ts @@ -29,7 +29,8 @@ export default class ServiceController { return await 'information of service'; } - async calculateCost(serviceName: string, requestData: string): Promise { + // FIXME(yoojin): Temporary deprecated. Need new pricing rules. + private async calculateCost(serviceName: string, requestData: string): Promise { const billingConfig = await this.ain.getValue(Path.app(serviceName).billingConfig()); const token = requestData.split(' ').length; let cost = token * billingConfig.costPerToken; diff --git a/src/service.ts b/src/service.ts index 216fae7..1c86ecf 100644 --- a/src/service.ts +++ b/src/service.ts @@ -30,7 +30,9 @@ export default class Service { * @returns {number} Estimated cost. */ async calculateCost (requestData: string) { - return await this.serviceController.calculateCost(this.serviceName, requestData); + // FIXME(yoojin): Temporary deprecated. Need new pricing rules. + // return await this.serviceController.calculateCost(this.serviceName, requestData); + return 0; } /**