diff --git a/src/modules/aiTools/ai-tools.service.ts b/src/modules/aiTools/ai-tools.service.ts index c60155c..966214f 100644 --- a/src/modules/aiTools/ai-tools.service.ts +++ b/src/modules/aiTools/ai-tools.service.ts @@ -34,7 +34,7 @@ export class AiToolsService { }, ], }; - + let response: any = await this.computeBhashini( this.configService.get('BHASHINI_DHRUVA_AUTHORIZATION'), 'txt-lang-detection', @@ -45,12 +45,12 @@ export class AiToolsService { userId, sessionId ) - if(response["error"]){ + if (response["error"]) { this.logger.error(response["error"]) throw new Error(response["error"]) } let language: Language; - if(response.output && response.output.length){ + if (response.output && response.output.length) { language = response.data?.pipelineResponse[0]?.output[0]?.langPrediction[0]?.langCode as Language this.monitoringService.incrementBhashiniSuccessCount() return { @@ -95,14 +95,14 @@ export class AiToolsService { const textWithoutUrls = text.replace(urlRegex, placeHolder); let config = { "language": { - "sourceLanguage": source, - "targetLanguage": target + "sourceLanguage": source, + "targetLanguage": target } } - let bhashiniConfig: any = await this.getBhashiniConfig('translation',config,userId,sessionId) - + let bhashiniConfig: any = await this.getBhashiniConfig('translation', config, userId, sessionId) + let textArray = textWithoutUrls.split("\n") - for(let i=0;i