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,
|
||||
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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<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.
|
||||
|
||||
let locale = min.core.getParam<string>(
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue