fix(kb.gbapp): Menu and Ask dialog flows fixing.

This commit is contained in:
Rodrigo Rodriguez 2019-02-01 10:58:11 -02:00
parent 4718fe4fc9
commit d884bc357d
5 changed files with 1841 additions and 2540 deletions

View file

@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

4230
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -48,30 +48,30 @@
"commit": "git-cz"
},
"dependencies": {
"@microsoft/microsoft-graph-client": "1.3.0",
"@semantic-release/exec": "^3.3.0",
"@microsoft/microsoft-graph-client": "1.4.0",
"@semantic-release/exec": "^3.3.2",
"adal-node": "0.1.28",
"async": "2.6.1",
"async-promises": "0.2.1",
"azure-arm-cognitiveservices": "2.4.0",
"azure-arm-resource": "7.2.1",
"azure-arm-cognitiveservices": "2.4.1",
"azure-arm-resource": "7.3.0",
"azure-arm-search": "^1.3.0-preview",
"azure-arm-sql": "5.6.0",
"azure-arm-website": "5.7.0",
"bluebird": "^3.5.3",
"body-parser": "1.18.3",
"botbuilder": "^4.1.7",
"botbuilder-ai": "^4.1.7",
"botbuilder-azure": "^4.1.7",
"botbuilder-ai": "^4.2.0",
"botbuilder-azure": "^4.2.0",
"botbuilder-choices": "^4.0.0-preview1.2",
"botbuilder-dialogs": "^4.1.7",
"botbuilder-dialogs": "^4.2.0",
"botbuilder-prompts": "^4.0.0-preview1.2",
"botlib": "^0.1.8",
"botlib": "^0.1.10",
"chai": "4.2.0",
"child_process": "^1.0.2",
"chokidar": "2.0.4",
"cli-spinner": "^0.2.8",
"csv-parse": "4.1.0",
"csv-parse": "4.3.1",
"dotenv-extended": "2.3.0",
"express": "4.16.4",
"express-promise-router": "3.0.3",
@ -79,68 +79,68 @@
"fs-walk": "0.0.2",
"ip": "^1.1.5",
"localize": "0.4.7",
"marked": "0.5.2",
"marked": "0.6.0",
"mocha": "5.2.0",
"mocha-typescript": "1.1.17",
"ms": "2.1.1",
"ms-rest-azure": "2.5.9",
"nexmo": "2.4.0",
"ms-rest-azure": "2.6.0",
"nexmo": "2.4.1",
"ngrok": "^3.1.0",
"nyc": "^13.1.0",
"opn": "^5.4.0",
"pragmatismo-io-framework": "1.0.19",
"process-exists": "^3.1.0",
"public-ip": "^2.4.0",
"reflect-metadata": "0.1.12",
"public-ip": "^3.0.0",
"reflect-metadata": "0.1.13",
"request-promise-native": "1.0.5",
"scanf": "^1.0.2",
"sequelize": "4.41.2",
"sequelize-typescript": "0.6.6",
"sequelize": "4.42.0",
"sequelize-typescript": "0.6.7",
"shx": "^0.3.2",
"simple-git": "^1.107.0",
"sqlite3": "4.0.4",
"strict-password-generator": "^1.1.1",
"sqlite3": "4.0.6",
"strict-password-generator": "^1.1.2",
"swagger-client": "3.8.22",
"tedious": "3.0.1",
"ts-node": "7.0.1",
"typedoc": "0.13.0",
"typedoc-plugin-external-module-name": "^1.1.3",
"typedoc-plugin-markdown": "^1.1.19",
"typescript": "3.2.1",
"tedious": "4.1.3",
"ts-node": "8.0.2",
"typedoc": "0.14.2",
"typedoc-plugin-external-module-name": "^2.0.0",
"typedoc-plugin-markdown": "^1.1.25",
"typescript": "3.3.1",
"url-join": "4.0.0",
"vbscript-to-typescript": "^1.0.8",
"wait-until": "0.0.2",
"walk-promise": "0.2.0",
"winston": "3.1.0"
"winston": "3.2.1"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.1",
"@semantic-release/changelog": "^3.0.2",
"@semantic-release/commit-analyzer": "^6.1.0",
"@semantic-release/git": "^7.0.5",
"@semantic-release/github": "^5.2.5",
"@semantic-release/npm": "^5.1.1",
"@semantic-release/git": "^7.0.8",
"@semantic-release/github": "^5.2.10",
"@semantic-release/npm": "^5.1.4",
"@semantic-release/release-notes-generator": "^7.1.4",
"@types/chai": "4.1.7",
"@types/mocha": "5.2.5",
"@types/sequelize": "4.27.32",
"@types/url-join": "0.8.2",
"@types/sequelize": "4.27.34",
"@types/url-join": "4.0.0",
"@types/winston": "2.4.4",
"ban-sensitive-files": "1.9.2",
"commitizen": "^3.0.4",
"commitizen": "^3.0.5",
"coveralls": "^3.0.2",
"cz-conventional-changelog": "^2.1.0",
"dependency-check": "3.2.1",
"dependency-check": "3.3.0",
"deps-ok": "1.4.1",
"git-issues": "1.3.1",
"license-checker": "24.0.1",
"license-checker": "25.0.1",
"nsp": "3.2.1",
"pre-git": "3.17.1",
"prettier-standard": "8.0.1",
"semantic-release": "^15.12.4",
"prettier-standard": "9.1.1",
"semantic-release": "^15.13.3",
"standard": "12.0.1",
"travis-deploy-once": "5.0.9",
"ts-loader": "^5.3.1",
"tslint": "^5.11.0",
"travis-deploy-once": "5.0.11",
"ts-loader": "^5.3.3",
"tslint": "^5.12.1",
"tslint-microsoft-contrib": "^6.0.0"
},
"eslintConfig": {

View file

@ -60,14 +60,8 @@ export class AskDialog extends IGBDialog {
new WaterfallDialog('/answerEvent', [
async step => {
if (step.options && step.options['questionId']) {
const question = await service.getQuestionById(
min.instance.instanceId,
step.options['questionId']
);
const answer = await service.getAnswerById(
min.instance.instanceId,
question.answerId
);
const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']);
const answer = await service.getAnswerById(min.instance.instanceId, question.answerId);
// Sends the answer to all outputs, including projector.
@ -106,10 +100,7 @@ export class AskDialog extends IGBDialog {
// Spells check the input text before sending Search or NLP.
if (min.instance.spellcheckerKey) {
const data = await AzureText.getSpelledText(
min.instance.spellcheckerKey,
text
);
const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text);
if (data != text) {
logger.info(`Spelling corrected: ${data}`);
@ -121,12 +112,7 @@ export class AskDialog extends IGBDialog {
user.lastQuestion = text;
await min.userProfile.set(step.context, user);
const resultsA = await service.ask(
min.instance,
text,
min.instance.searchScore,
user.subjects
);
const resultsA = await service.ask(min.instance, text, min.instance.searchScore, user.subjects);
// If there is some result, answer immediately.
@ -139,30 +125,19 @@ export class AskDialog extends IGBDialog {
// Sends the answer to all outputs, including projector.
await service.sendAnswer(
min.conversationalService,
step,
resultsA.answer
);
await service.sendAnswer(min.conversationalService, step, resultsA.answer);
// Goes to ask loop, again.
return await step.replaceDialog('/ask', { isReturning: true });
} else {
// Second time running Search, now with no filter.
const resultsB = await service.ask(
min.instance,
text,
min.instance.searchScore,
null
);
const resultsB = await service.ask(min.instance, text, min.instance.searchScore, null);
// If there is some result, answer immediately.
if (resultsB && resultsB.answer) {
// Saves some context info.
const user = await min.userProfile.get(step.context, {});
@ -173,24 +148,16 @@ export class AskDialog extends IGBDialog {
// Informs user that a broader search will be used.
if (user.subjects.length > 0) {
const subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(
user.subjects
)}`;
const subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(user.subjects)}`;
await step.context.sendActivity(Messages[locale].wider_answer);
}
// Sends the answer to all outputs, including projector.
await service.sendAnswer(
min.conversationalService,
step,
resultsB.answer
);
await service.sendAnswer(min.conversationalService, step, resultsB.answer);
return await step.replaceDialog('/ask', { isReturning: true });
} else {
if (
!(await min.conversationalService.routeNLP(step, min, text))
) {
if (!(await min.conversationalService.routeNLP(step, min, text))) {
await step.context.sendActivity(Messages[locale].did_not_find);
return await step.replaceDialog('/ask', { isReturning: true });
}
@ -229,7 +196,11 @@ export class AskDialog extends IGBDialog {
return await step.next();
},
async step => {
return await step.replaceDialog('/answer', { query: step.result });
if (step.result) {
return await step.replaceDialog('/answer', { query: step.result });
} else {
return await step.next();
}
}
])
);

View file

@ -64,7 +64,7 @@ export class MenuDialog extends IGBDialog {
let rootSubjectId = null;
if (step.options && step.options['data']) {
const subject = step.result.data;
const subject = step.options['data'];
// If there is a shortcut specified as subject destination, go there.
@ -149,7 +149,6 @@ export class MenuDialog extends IGBDialog {
);
}
await step.replaceDialog('/ask', {});
} else {
msg.attachments = attachments;
await step.context.sendActivity(msg);
@ -158,16 +157,6 @@ export class MenuDialog extends IGBDialog {
const user = await min.userProfile.get(step.context, {});
user.isAsking = true;
return await step.next();
},
async step => {
const text = step.result;
const locale = step.context.activity.locale;
if (AzureText.isIntentNo(locale, text)) {
await step.replaceDialog('/feedback');
} else {
await step.replaceDialog('/ask');
}
return await step.next();
}
]));
}