fix(core.gbapp): NLP key bug fixed after MSFT change of NLP service.
This commit is contained in:
parent
76d175dcd2
commit
b901d6bd50
3 changed files with 26 additions and 5 deletions
|
@ -694,7 +694,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
||||||
location: string,
|
location: string,
|
||||||
nlpAppId: string,
|
nlpAppId: string,
|
||||||
clEntityId: string,
|
clEntityId: string,
|
||||||
nlpAuthoringKey: string,
|
nlpKey: string,
|
||||||
data: any,
|
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.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('Content-Type', 'application/json');
|
||||||
req.headers.set('accept-language', '*');
|
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);
|
req.body = JSON.stringify(data);
|
||||||
const httpClient = new ServiceClient();
|
const httpClient = new ServiceClient();
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ export class GBDeployer implements IGBDeployer {
|
||||||
instance.cloudLocation,
|
instance.cloudLocation,
|
||||||
instance.nlpAppId,
|
instance.nlpAppId,
|
||||||
listName,
|
listName,
|
||||||
instance.nlpAuthoringKey,
|
instance.nlpKey,
|
||||||
listData
|
listData
|
||||||
);
|
);
|
||||||
if (res.status !== 200) throw res.bodyAsText;
|
if (res.status !== 200) throw res.bodyAsText;
|
||||||
|
|
|
@ -782,8 +782,21 @@ export class GBMinService {
|
||||||
|
|
||||||
// Spells check the input text before translating.
|
// Spells check the input text before translating.
|
||||||
|
|
||||||
text = await min.conversationalService.spellCheck(min, text);
|
const keepText: string = min.core.getParam<string>(
|
||||||
|
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.
|
// Detects user typed language and updates their locale profile if applies.
|
||||||
|
|
||||||
let locale = min.core.getParam<string>(
|
let locale = min.core.getParam<string>(
|
||||||
|
@ -823,6 +836,14 @@ export class GBMinService {
|
||||||
);
|
);
|
||||||
|
|
||||||
text = await min.conversationalService.translate(min, text, contentLocale);
|
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}.`);
|
GBLog.info(`Translated text (processMessageActivity): ${text}.`);
|
||||||
context.activity.text = text;
|
context.activity.text = text;
|
||||||
context.activity.originalText = originalText;
|
context.activity.originalText = originalText;
|
||||||
|
|
Loading…
Add table
Reference in a new issue