Skip to content

Commit

Permalink
fix(all): Language and Spellchecker are now modern.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Nov 26, 2020
1 parent eb076b5 commit 3eb8d0a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class GBConversationalService {
return new Promise<string>(async (resolve, reject) => {
try {
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(null);

Expand Down Expand Up @@ -485,9 +485,8 @@ 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 : ''
} {error.message; }`;
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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -640,7 +641,7 @@ export class GBConversationalService {
GBLog.info(`Translated text(sendText): ${text}.`);

const analytics = new AnalyticsService();

analytics.createMessage(min.instance.instanceId, user.conversation, null, text);

if (!isNaN(member.id)) {
Expand Down

0 comments on commit 3eb8d0a

Please sign in to comment.