fix(core.gbapp): MSFT translator fixes and auto-start twice fixed.
This commit is contained in:
parent
bd965913fe
commit
81a0fdd5d0
2 changed files with 30 additions and 27 deletions
|
@ -676,11 +676,13 @@ export class GBConversationalService {
|
||||||
if (!key) {
|
if (!key) {
|
||||||
return process.env.DEFAULT_USER_LANGUAGE;
|
return process.env.DEFAULT_USER_LANGUAGE;
|
||||||
}
|
}
|
||||||
return await AzureText.getLocale(
|
let language = await AzureText.getLocale(
|
||||||
key,
|
key,
|
||||||
min.core.getParam<string>(min.instance, 'textAnalyticsEndpoint', null),
|
min.core.getParam<string>(min.instance, 'textAnalyticsEndpoint', null),
|
||||||
text
|
text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return language === '(Unknown)' ? 'en' : language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async spellCheck(min: GBMinInstance, text: string): Promise<string> {
|
public async spellCheck(min: GBMinInstance, text: string): Promise<string> {
|
||||||
|
|
|
@ -197,6 +197,7 @@ export class GBMinService {
|
||||||
|
|
||||||
await (activeMin as any).whatsAppDirectLine.resetConversationId(id);
|
await (activeMin as any).whatsAppDirectLine.resetConversationId(id);
|
||||||
let startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null);
|
let startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null);
|
||||||
|
|
||||||
GBLog.info(`Auto start dialog is now being called: ${startDialog}...`);
|
GBLog.info(`Auto start dialog is now being called: ${startDialog}...`);
|
||||||
|
|
||||||
if (startDialog) {
|
if (startDialog) {
|
||||||
|
@ -634,6 +635,7 @@ export class GBMinService {
|
||||||
user.loaded = true;
|
user.loaded = true;
|
||||||
user.subjects = [];
|
user.subjects = [];
|
||||||
user.cb = undefined;
|
user.cb = undefined;
|
||||||
|
user.welcomed = false;
|
||||||
|
|
||||||
if (context.activity.from.id !== min.botId) {
|
if (context.activity.from.id !== min.botId) {
|
||||||
const member = context.activity.from;
|
const member = context.activity.from;
|
||||||
|
@ -676,8 +678,8 @@ export class GBMinService {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
|
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
|
||||||
if (startDialog)
|
if (startDialog && !user.welcomed) {
|
||||||
{
|
user.welcomed = true;
|
||||||
GBLog.info(`Auto start dialog is now being called: ${startDialog}...`);
|
GBLog.info(`Auto start dialog is now being called: ${startDialog}...`);
|
||||||
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
|
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
|
||||||
}
|
}
|
||||||
|
@ -921,27 +923,26 @@ export class GBMinService {
|
||||||
} else {
|
} else {
|
||||||
// Checks if any .gbapp will handle this answer, if not goes to standard kb.gbapp.
|
// Checks if any .gbapp will handle this answer, if not goes to standard kb.gbapp.
|
||||||
|
|
||||||
let handled = false;
|
let nextDialog = null;
|
||||||
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
||||||
if (
|
|
||||||
await e.onExchangeData(min, 'handleAnswer', {
|
nextDialog = await e.onExchangeData(min, 'handleAnswer', {
|
||||||
query: text,
|
query: text,
|
||||||
step: step,
|
step: step,
|
||||||
notTranslatedQuery: originalText,
|
notTranslatedQuery: originalText,
|
||||||
message: message ? message['dataValues'] : null,
|
message: message ? message['dataValues'] : null,
|
||||||
user: user ? user['dataValues'] : null
|
user: user ? user['dataValues'] : null
|
||||||
})
|
|
||||||
) {
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (!handled) {
|
|
||||||
await step.beginDialog('/answer', {
|
|
||||||
|
});
|
||||||
|
|
||||||
|
await step.beginDialog(nextDialog ? nextDialog : '/answer', {
|
||||||
query: text,
|
query: text,
|
||||||
user: user ? user['dataValues'] : null,
|
user: user ? user['dataValues'] : null,
|
||||||
message: message
|
message: message
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue