fix(all): Language and Spellchecker are now modern.
This commit is contained in:
parent
eb076b5637
commit
3eb8d0a53f
1 changed files with 10 additions and 9 deletions
|
@ -209,7 +209,7 @@ export class GBConversationalService {
|
||||||
return new Promise<string>(async (resolve, reject) => {
|
return new Promise<string>(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const oggFile = new Readable();
|
const oggFile = new Readable();
|
||||||
oggFile._read = () => {}; // _read is required but you can noop it
|
oggFile._read = () => { }; // _read is required but you can noop it
|
||||||
oggFile.push(buffer);
|
oggFile.push(buffer);
|
||||||
oggFile.push(null);
|
oggFile.push(null);
|
||||||
|
|
||||||
|
@ -485,9 +485,8 @@ export class GBConversationalService {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
const msg = `Error calling NLP, check if you have a published model and assigned keys. Error: ${
|
const msg = `Error calling NLP, check if you have a published model and assigned keys. Error: ${error.statusCode ? error.statusCode : ''
|
||||||
error.statusCode ? error.statusCode : ''
|
} {error.message; }`;
|
||||||
} {error.message; }`;
|
|
||||||
|
|
||||||
throw new Error(msg);
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
|
@ -534,17 +533,19 @@ export class GBConversationalService {
|
||||||
|
|
||||||
public async getLanguage(min: GBMinInstance, text: string): Promise<string> {
|
public async getLanguage(min: GBMinInstance, text: string): Promise<string> {
|
||||||
return await AzureText.getLocale(
|
return await AzureText.getLocale(
|
||||||
min.instance.textAnalyticsKey ? min.instance.textAnalyticsKey : min.instance.textAnalyticsKey,
|
min.core.getParam<string>(min.instance, 'textAnalyticsKey', null),
|
||||||
min.instance.textAnalyticsEndpoint ? min.instance.textAnalyticsEndpoint : min.instance.textAnalyticsEndpoint,
|
min.core.getParam<string>(min.instance, 'textAnalyticsEndpoint', null),
|
||||||
text
|
text
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async spellCheck(min: GBMinInstance, text: string): Promise<string> {
|
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) {
|
if (key) {
|
||||||
text = text.charAt(0).toUpperCase() + text.slice(1);
|
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) {
|
if (data !== text) {
|
||||||
GBLog.info(`Spelling corrected (processMessageActivity): ${data}`);
|
GBLog.info(`Spelling corrected (processMessageActivity): ${data}`);
|
||||||
text = data;
|
text = data;
|
||||||
|
@ -640,7 +641,7 @@ export class GBConversationalService {
|
||||||
GBLog.info(`Translated text(sendText): ${text}.`);
|
GBLog.info(`Translated text(sendText): ${text}.`);
|
||||||
|
|
||||||
const analytics = new AnalyticsService();
|
const analytics = new AnalyticsService();
|
||||||
|
|
||||||
analytics.createMessage(min.instance.instanceId, user.conversation, null, text);
|
analytics.createMessage(min.instance.instanceId, user.conversation, null, text);
|
||||||
|
|
||||||
if (!isNaN(member.id)) {
|
if (!isNaN(member.id)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue