Skip to content

Commit

Permalink
fix(core.gbapp): Fixed translator bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jul 17, 2020
1 parent 3890460 commit 0accd05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/core.gbapp/services/GBConversationalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class GBConversationalService {
});
}

public static async getTextFromAudioBuffer(speechKey, cloudRegion, buffer, locale): Promise<string> {
public static async getTextFromAudioBuffer(speechKey, cloudRegion, buffer, locale): Promise<string> {
return new Promise<string>(async (resolve, reject) => {
try {
let subscriptionKey = speechKey;
Expand Down Expand Up @@ -603,20 +603,23 @@ export class GBConversationalService {
}

public async sendText(min, step, text) {
let sec = new SecService();
const member = step.context.activity.from;
const user = await min.userProfile.get(step.context, {});
const user = await sec.ensureUser(min.instance.instanceId, member.id,
member.name, "", "web", member.name);

if (user) {
const minBoot = GBServer.globals.minBoot as any;
text = await min.conversationalService.translate(min,
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
text,
user.systemUser.locale ? user.systemUser.locale : 'pt'
user.locale ? user.locale : 'pt'
);
const analytics = new AnalyticsService();

const userProfile = await min.userProfile.get(step.context, {});
analytics.createMessage(min.instance.instanceId,
user.conversation, null,
userProfile.conversation, null,
text);

if (!isNaN(member.id)) {
Expand Down
2 changes: 2 additions & 0 deletions packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ export class GBDeployer implements IGBDeployer {
}
}

// TODO: Use temporary names for index for exchanging them after the new one is created.

try {
await search.deleteIndex();
} catch (err) {
Expand Down

0 comments on commit 0accd05

Please sign in to comment.