fix(kb.gbapp): Menu and Ask dialog flows fixing.
This commit is contained in:
parent
4718fe4fc9
commit
d884bc357d
5 changed files with 1841 additions and 2540 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"git.ignoreLimitWarning": true
|
||||||
|
}
|
4206
package-lock.json
generated
4206
package-lock.json
generated
File diff suppressed because it is too large
Load diff
78
package.json
78
package.json
|
@ -48,30 +48,30 @@
|
||||||
"commit": "git-cz"
|
"commit": "git-cz"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@microsoft/microsoft-graph-client": "1.3.0",
|
"@microsoft/microsoft-graph-client": "1.4.0",
|
||||||
"@semantic-release/exec": "^3.3.0",
|
"@semantic-release/exec": "^3.3.2",
|
||||||
"adal-node": "0.1.28",
|
"adal-node": "0.1.28",
|
||||||
"async": "2.6.1",
|
"async": "2.6.1",
|
||||||
"async-promises": "0.2.1",
|
"async-promises": "0.2.1",
|
||||||
"azure-arm-cognitiveservices": "2.4.0",
|
"azure-arm-cognitiveservices": "2.4.1",
|
||||||
"azure-arm-resource": "7.2.1",
|
"azure-arm-resource": "7.3.0",
|
||||||
"azure-arm-search": "^1.3.0-preview",
|
"azure-arm-search": "^1.3.0-preview",
|
||||||
"azure-arm-sql": "5.6.0",
|
"azure-arm-sql": "5.6.0",
|
||||||
"azure-arm-website": "5.7.0",
|
"azure-arm-website": "5.7.0",
|
||||||
"bluebird": "^3.5.3",
|
"bluebird": "^3.5.3",
|
||||||
"body-parser": "1.18.3",
|
"body-parser": "1.18.3",
|
||||||
"botbuilder": "^4.1.7",
|
"botbuilder": "^4.1.7",
|
||||||
"botbuilder-ai": "^4.1.7",
|
"botbuilder-ai": "^4.2.0",
|
||||||
"botbuilder-azure": "^4.1.7",
|
"botbuilder-azure": "^4.2.0",
|
||||||
"botbuilder-choices": "^4.0.0-preview1.2",
|
"botbuilder-choices": "^4.0.0-preview1.2",
|
||||||
"botbuilder-dialogs": "^4.1.7",
|
"botbuilder-dialogs": "^4.2.0",
|
||||||
"botbuilder-prompts": "^4.0.0-preview1.2",
|
"botbuilder-prompts": "^4.0.0-preview1.2",
|
||||||
"botlib": "^0.1.8",
|
"botlib": "^0.1.10",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
"child_process": "^1.0.2",
|
"child_process": "^1.0.2",
|
||||||
"chokidar": "2.0.4",
|
"chokidar": "2.0.4",
|
||||||
"cli-spinner": "^0.2.8",
|
"cli-spinner": "^0.2.8",
|
||||||
"csv-parse": "4.1.0",
|
"csv-parse": "4.3.1",
|
||||||
"dotenv-extended": "2.3.0",
|
"dotenv-extended": "2.3.0",
|
||||||
"express": "4.16.4",
|
"express": "4.16.4",
|
||||||
"express-promise-router": "3.0.3",
|
"express-promise-router": "3.0.3",
|
||||||
|
@ -79,68 +79,68 @@
|
||||||
"fs-walk": "0.0.2",
|
"fs-walk": "0.0.2",
|
||||||
"ip": "^1.1.5",
|
"ip": "^1.1.5",
|
||||||
"localize": "0.4.7",
|
"localize": "0.4.7",
|
||||||
"marked": "0.5.2",
|
"marked": "0.6.0",
|
||||||
"mocha": "5.2.0",
|
"mocha": "5.2.0",
|
||||||
"mocha-typescript": "1.1.17",
|
"mocha-typescript": "1.1.17",
|
||||||
"ms": "2.1.1",
|
"ms": "2.1.1",
|
||||||
"ms-rest-azure": "2.5.9",
|
"ms-rest-azure": "2.6.0",
|
||||||
"nexmo": "2.4.0",
|
"nexmo": "2.4.1",
|
||||||
"ngrok": "^3.1.0",
|
"ngrok": "^3.1.0",
|
||||||
"nyc": "^13.1.0",
|
"nyc": "^13.1.0",
|
||||||
"opn": "^5.4.0",
|
"opn": "^5.4.0",
|
||||||
"pragmatismo-io-framework": "1.0.19",
|
"pragmatismo-io-framework": "1.0.19",
|
||||||
"process-exists": "^3.1.0",
|
"process-exists": "^3.1.0",
|
||||||
"public-ip": "^2.4.0",
|
"public-ip": "^3.0.0",
|
||||||
"reflect-metadata": "0.1.12",
|
"reflect-metadata": "0.1.13",
|
||||||
"request-promise-native": "1.0.5",
|
"request-promise-native": "1.0.5",
|
||||||
"scanf": "^1.0.2",
|
"scanf": "^1.0.2",
|
||||||
"sequelize": "4.41.2",
|
"sequelize": "4.42.0",
|
||||||
"sequelize-typescript": "0.6.6",
|
"sequelize-typescript": "0.6.7",
|
||||||
"shx": "^0.3.2",
|
"shx": "^0.3.2",
|
||||||
"simple-git": "^1.107.0",
|
"simple-git": "^1.107.0",
|
||||||
"sqlite3": "4.0.4",
|
"sqlite3": "4.0.6",
|
||||||
"strict-password-generator": "^1.1.1",
|
"strict-password-generator": "^1.1.2",
|
||||||
"swagger-client": "3.8.22",
|
"swagger-client": "3.8.22",
|
||||||
"tedious": "3.0.1",
|
"tedious": "4.1.3",
|
||||||
"ts-node": "7.0.1",
|
"ts-node": "8.0.2",
|
||||||
"typedoc": "0.13.0",
|
"typedoc": "0.14.2",
|
||||||
"typedoc-plugin-external-module-name": "^1.1.3",
|
"typedoc-plugin-external-module-name": "^2.0.0",
|
||||||
"typedoc-plugin-markdown": "^1.1.19",
|
"typedoc-plugin-markdown": "^1.1.25",
|
||||||
"typescript": "3.2.1",
|
"typescript": "3.3.1",
|
||||||
"url-join": "4.0.0",
|
"url-join": "4.0.0",
|
||||||
"vbscript-to-typescript": "^1.0.8",
|
"vbscript-to-typescript": "^1.0.8",
|
||||||
"wait-until": "0.0.2",
|
"wait-until": "0.0.2",
|
||||||
"walk-promise": "0.2.0",
|
"walk-promise": "0.2.0",
|
||||||
"winston": "3.1.0"
|
"winston": "3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@semantic-release/changelog": "^3.0.1",
|
"@semantic-release/changelog": "^3.0.2",
|
||||||
"@semantic-release/commit-analyzer": "^6.1.0",
|
"@semantic-release/commit-analyzer": "^6.1.0",
|
||||||
"@semantic-release/git": "^7.0.5",
|
"@semantic-release/git": "^7.0.8",
|
||||||
"@semantic-release/github": "^5.2.5",
|
"@semantic-release/github": "^5.2.10",
|
||||||
"@semantic-release/npm": "^5.1.1",
|
"@semantic-release/npm": "^5.1.4",
|
||||||
"@semantic-release/release-notes-generator": "^7.1.4",
|
"@semantic-release/release-notes-generator": "^7.1.4",
|
||||||
"@types/chai": "4.1.7",
|
"@types/chai": "4.1.7",
|
||||||
"@types/mocha": "5.2.5",
|
"@types/mocha": "5.2.5",
|
||||||
"@types/sequelize": "4.27.32",
|
"@types/sequelize": "4.27.34",
|
||||||
"@types/url-join": "0.8.2",
|
"@types/url-join": "4.0.0",
|
||||||
"@types/winston": "2.4.4",
|
"@types/winston": "2.4.4",
|
||||||
"ban-sensitive-files": "1.9.2",
|
"ban-sensitive-files": "1.9.2",
|
||||||
"commitizen": "^3.0.4",
|
"commitizen": "^3.0.5",
|
||||||
"coveralls": "^3.0.2",
|
"coveralls": "^3.0.2",
|
||||||
"cz-conventional-changelog": "^2.1.0",
|
"cz-conventional-changelog": "^2.1.0",
|
||||||
"dependency-check": "3.2.1",
|
"dependency-check": "3.3.0",
|
||||||
"deps-ok": "1.4.1",
|
"deps-ok": "1.4.1",
|
||||||
"git-issues": "1.3.1",
|
"git-issues": "1.3.1",
|
||||||
"license-checker": "24.0.1",
|
"license-checker": "25.0.1",
|
||||||
"nsp": "3.2.1",
|
"nsp": "3.2.1",
|
||||||
"pre-git": "3.17.1",
|
"pre-git": "3.17.1",
|
||||||
"prettier-standard": "8.0.1",
|
"prettier-standard": "9.1.1",
|
||||||
"semantic-release": "^15.12.4",
|
"semantic-release": "^15.13.3",
|
||||||
"standard": "12.0.1",
|
"standard": "12.0.1",
|
||||||
"travis-deploy-once": "5.0.9",
|
"travis-deploy-once": "5.0.11",
|
||||||
"ts-loader": "^5.3.1",
|
"ts-loader": "^5.3.3",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.12.1",
|
||||||
"tslint-microsoft-contrib": "^6.0.0"
|
"tslint-microsoft-contrib": "^6.0.0"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|
|
@ -60,14 +60,8 @@ export class AskDialog extends IGBDialog {
|
||||||
new WaterfallDialog('/answerEvent', [
|
new WaterfallDialog('/answerEvent', [
|
||||||
async step => {
|
async step => {
|
||||||
if (step.options && step.options['questionId']) {
|
if (step.options && step.options['questionId']) {
|
||||||
const question = await service.getQuestionById(
|
const question = await service.getQuestionById(min.instance.instanceId, step.options['questionId']);
|
||||||
min.instance.instanceId,
|
const answer = await service.getAnswerById(min.instance.instanceId, question.answerId);
|
||||||
step.options['questionId']
|
|
||||||
);
|
|
||||||
const answer = await service.getAnswerById(
|
|
||||||
min.instance.instanceId,
|
|
||||||
question.answerId
|
|
||||||
);
|
|
||||||
|
|
||||||
// Sends the answer to all outputs, including projector.
|
// 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.
|
// Spells check the input text before sending Search or NLP.
|
||||||
|
|
||||||
if (min.instance.spellcheckerKey) {
|
if (min.instance.spellcheckerKey) {
|
||||||
const data = await AzureText.getSpelledText(
|
const data = await AzureText.getSpelledText(min.instance.spellcheckerKey, text);
|
||||||
min.instance.spellcheckerKey,
|
|
||||||
text
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data != text) {
|
if (data != text) {
|
||||||
logger.info(`Spelling corrected: ${data}`);
|
logger.info(`Spelling corrected: ${data}`);
|
||||||
|
@ -121,12 +112,7 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
user.lastQuestion = text;
|
user.lastQuestion = text;
|
||||||
await min.userProfile.set(step.context, user);
|
await min.userProfile.set(step.context, user);
|
||||||
const resultsA = await service.ask(
|
const resultsA = await service.ask(min.instance, text, min.instance.searchScore, user.subjects);
|
||||||
min.instance,
|
|
||||||
text,
|
|
||||||
min.instance.searchScore,
|
|
||||||
user.subjects
|
|
||||||
);
|
|
||||||
|
|
||||||
// If there is some result, answer immediately.
|
// If there is some result, answer immediately.
|
||||||
|
|
||||||
|
@ -139,30 +125,19 @@ export class AskDialog extends IGBDialog {
|
||||||
|
|
||||||
// Sends the answer to all outputs, including projector.
|
// Sends the answer to all outputs, including projector.
|
||||||
|
|
||||||
await service.sendAnswer(
|
await service.sendAnswer(min.conversationalService, step, resultsA.answer);
|
||||||
min.conversationalService,
|
|
||||||
step,
|
|
||||||
resultsA.answer
|
|
||||||
);
|
|
||||||
|
|
||||||
// Goes to ask loop, again.
|
// Goes to ask loop, again.
|
||||||
|
|
||||||
return await step.replaceDialog('/ask', { isReturning: true });
|
return await step.replaceDialog('/ask', { isReturning: true });
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Second time running Search, now with no filter.
|
// Second time running Search, now with no filter.
|
||||||
|
|
||||||
const resultsB = await service.ask(
|
const resultsB = await service.ask(min.instance, text, min.instance.searchScore, null);
|
||||||
min.instance,
|
|
||||||
text,
|
|
||||||
min.instance.searchScore,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
// If there is some result, answer immediately.
|
// If there is some result, answer immediately.
|
||||||
|
|
||||||
if (resultsB && resultsB.answer) {
|
if (resultsB && resultsB.answer) {
|
||||||
|
|
||||||
// Saves some context info.
|
// Saves some context info.
|
||||||
|
|
||||||
const user = await min.userProfile.get(step.context, {});
|
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.
|
// Informs user that a broader search will be used.
|
||||||
|
|
||||||
if (user.subjects.length > 0) {
|
if (user.subjects.length > 0) {
|
||||||
const subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(
|
const subjectText = `${KBService.getSubjectItemsSeparatedBySpaces(user.subjects)}`;
|
||||||
user.subjects
|
|
||||||
)}`;
|
|
||||||
await step.context.sendActivity(Messages[locale].wider_answer);
|
await step.context.sendActivity(Messages[locale].wider_answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends the answer to all outputs, including projector.
|
// Sends the answer to all outputs, including projector.
|
||||||
|
|
||||||
await service.sendAnswer(
|
await service.sendAnswer(min.conversationalService, step, resultsB.answer);
|
||||||
min.conversationalService,
|
|
||||||
step,
|
|
||||||
resultsB.answer
|
|
||||||
);
|
|
||||||
return await step.replaceDialog('/ask', { isReturning: true });
|
return await step.replaceDialog('/ask', { isReturning: true });
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (!(await min.conversationalService.routeNLP(step, min, text))) {
|
||||||
!(await min.conversationalService.routeNLP(step, min, text))
|
|
||||||
) {
|
|
||||||
await step.context.sendActivity(Messages[locale].did_not_find);
|
await step.context.sendActivity(Messages[locale].did_not_find);
|
||||||
return await step.replaceDialog('/ask', { isReturning: true });
|
return await step.replaceDialog('/ask', { isReturning: true });
|
||||||
}
|
}
|
||||||
|
@ -229,7 +196,11 @@ export class AskDialog extends IGBDialog {
|
||||||
return await step.next();
|
return await step.next();
|
||||||
},
|
},
|
||||||
async step => {
|
async step => {
|
||||||
|
if (step.result) {
|
||||||
return await step.replaceDialog('/answer', { query: step.result });
|
return await step.replaceDialog('/answer', { query: step.result });
|
||||||
|
} else {
|
||||||
|
return await step.next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
|
@ -64,7 +64,7 @@ export class MenuDialog extends IGBDialog {
|
||||||
let rootSubjectId = null;
|
let rootSubjectId = null;
|
||||||
|
|
||||||
if (step.options && step.options['data']) {
|
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.
|
// 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 {
|
} else {
|
||||||
msg.attachments = attachments;
|
msg.attachments = attachments;
|
||||||
await step.context.sendActivity(msg);
|
await step.context.sendActivity(msg);
|
||||||
|
@ -158,16 +157,6 @@ export class MenuDialog extends IGBDialog {
|
||||||
const user = await min.userProfile.get(step.context, {});
|
const user = await min.userProfile.get(step.context, {});
|
||||||
user.isAsking = true;
|
user.isAsking = true;
|
||||||
return await step.next();
|
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();
|
|
||||||
}
|
}
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue