diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 0b124cff..1af957eb 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -694,7 +694,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { location: string, nlpAppId: string, clEntityId: string, - nlpAuthoringKey: string, + nlpKey: string, data: any, ) { @@ -703,7 +703,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { req.url = `https://${location}.api.cognitive.microsoft.com/luis/api/v2.0/apps/${nlpAppId}/versions/0.1/closedlists/${clEntityId}`; req.headers.set('Content-Type', 'application/json'); req.headers.set('accept-language', '*'); - req.headers.set('Ocp-Apim-Subscription-Key', nlpAuthoringKey); + req.headers.set('Ocp-Apim-Subscription-Key', nlpKey); req.body = JSON.stringify(data); const httpClient = new ServiceClient(); diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 781736ce..b9c71bdb 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -269,7 +269,7 @@ export class GBDeployer implements IGBDeployer { instance.cloudLocation, instance.nlpAppId, listName, - instance.nlpAuthoringKey, + instance.nlpKey, listData ); if (res.status !== 200) throw res.bodyAsText; diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 5130673e..917933fd 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -190,7 +190,7 @@ export class GBMinService { id, `Agora falando com ${activeMin.instance.title}...` ); - + let startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null); GBLog.info(`Auto start dialog is now being called: ${startDialog}...`); if (startDialog) { @@ -782,8 +782,21 @@ export class GBMinService { // Spells check the input text before translating. - text = await min.conversationalService.spellCheck(min, text); + const keepText: string = min.core.getParam( + min.instance, + 'Keep Text', + null + ); + if (keepText) { + const list = keepText.split(';'); + let i = 0; + await CollectionUtil.asyncForEach(list, item => { + i++; + text = text.replace(new RegExp(item.trim(), 'gi'), `KEEPTEXT${i}`); + }); + } + text = await min.conversationalService.spellCheck(min, text); // Detects user typed language and updates their locale profile if applies. let locale = min.core.getParam( @@ -823,6 +836,14 @@ export class GBMinService { ); text = await min.conversationalService.translate(min, text, contentLocale); + if (keepText) { + const list = keepText.split(';'); + let i = 0; + await CollectionUtil.asyncForEach(list, item => { + i++; + text = text.replace(`KEEPTEXT${i}`, item.trim()); + }); + } GBLog.info(`Translated text (processMessageActivity): ${text}.`); context.activity.text = text; context.activity.originalText = originalText;