fix(all): Language and Spellchecker are now modern.

This commit is contained in:
Rodrigo Rodriguez 2020-11-26 10:47:35 -03:00
parent eb076b5637
commit 3eb8d0a53f

View file

@ -485,8 +485,7 @@ export class GBConversationalService {
return false;
} else {
const msg = `Error calling NLP, check if you have a published model and assigned keys. Error: ${
error.statusCode ? error.statusCode : ''
const msg = `Error calling NLP, check if you have a published model and assigned keys. Error: ${error.statusCode ? error.statusCode : ''
} {error.message; }`;
throw new Error(msg);
@ -534,17 +533,19 @@ export class GBConversationalService {
public async getLanguage(min: GBMinInstance, text: string): Promise<string> {
return await AzureText.getLocale(
min.instance.textAnalyticsKey ? min.instance.textAnalyticsKey : min.instance.textAnalyticsKey,
min.instance.textAnalyticsEndpoint ? min.instance.textAnalyticsEndpoint : min.instance.textAnalyticsEndpoint,
min.core.getParam<string>(min.instance, 'textAnalyticsKey', null),
min.core.getParam<string>(min.instance, 'textAnalyticsEndpoint', null),
text
);
}
public async spellCheck(min: GBMinInstance, text: string): Promise<string> {
const key = min.instance.spellcheckerKey ? min.instance.spellcheckerKey : min.instance.spellcheckerKey;
const key =
min.core.getParam<string>(min.instance, 'spellcheckerKey', null);
if (key) {
text = text.charAt(0).toUpperCase() + text.slice(1);
const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text);
const data = await AzureText.getSpelledText(key, text);
if (data !== text) {
GBLog.info(`Spelling corrected (processMessageActivity): ${data}`);
text = data;