Skip to content

Commit 89fee87

Browse files
authored
Merge pull request #1 from igorzhilin/master
Freezing further bot development
2 parents c33d9b8 + 34223d8 commit 89fee87

21 files changed

Lines changed: 1557 additions & 1005 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# TaxBot
2-
KPMG Virtual Tax Advisor
2+
Virtual Tax Advisor

messages/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
.env
2+
*.jpg
3+
*.backup
4+
*.pdf
5+
launch.json

messages/.vscode/launch.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
"type": "node",
88
"request": "launch",
99
"program": "${workspaceRoot}/index.js",
10-
"cwd": "${workspaceRoot}",
11-
"env": {
12-
"NODE_ENV": "development",
13-
"LuisAppId": "",
14-
"LuisAPIKey": ""
15-
}
10+
"cwd": "${workspaceRoot}"
11+
},
12+
{
13+
"name": "Attach to Process",
14+
"type": "node",
15+
"request": "attach",
16+
"port": 5858
1617
}
1718
]
1819
}

messages/dialogs/askCanton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
if (session.privateConversationData.canton) {
99
session.endDialog();
1010
} else {
11-
builder.Prompts.text(session, 'In welchem Kanton ist Ihr Unternehmen ansässig?');
11+
builder.Prompts.choice(session, 'In welchem Kanton ist Ihr Unternehmen ansässig?','Zürich|Bern|Luzern|Uri|Schwyz|Obwalden|Nidwalden|Glarus|Zug|Freiburg|Solothurn|Basel-Stadt|Basel-Landschaft|Schaffhausen|Appenzell A. Rh.|Appenzell I. Rh.|St. Gallen|Graubünden|Aargau|Thurgau|Tessin|Waadt|Wallis|Neuenburg|Genf|Jura', {listStyle: 3});
1212
}
1313
},
1414
function (session, results) {

messages/dialogs/askContactNames.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,16 @@ module.exports = {
55
Label: 'Contact form',
66
Dialog: [
77
function (session) {
8-
builder.Prompts.text(session, 'Wie lautet Ihr Nachname?');
8+
session.send("Ich möchte jetzt Ihre Kontaktdaten sammeln.");
9+
builder.Prompts.text(session, 'Wie lautet Ihre Vollname?');
910
},
1011
function (session, results) {
11-
if (results.response) {
12-
session.privateConversationData.familyname = results.response;
13-
}
14-
builder.Prompts.text(session, 'Wie lautet Ihr Vorhname?');
12+
session.privateConversationData.fullname = results.response;
13+
builder.Prompts.text(session, 'Wie und wann kann KPMG Sie kontaktieren? Sie können einfach schreiben "Dienstag Morgens, Natel 078 888 33 99" oder "Jederzeit mein.email@meine.firma" oder beide.');
1514
},
1615
function (session, results) {
17-
if (results.response) {
18-
session.privateConversationData.firstname = results.response;
19-
}
20-
builder.Prompts.choice(session, 'Vielen Dank. Wünschen Sie eine Kontaktaufnahme per Email oder Telefon?',
21-
['Email', 'Telefon'],
22-
{retryPrompt: "I verstehe nicht. Bitte antworten 'Email' oder 'Telefon'."});
23-
},
24-
function (session, results) {
25-
session.endDialogWithResult(results.response);
16+
session.privateConversationData.fullcontact = results.response;
17+
session.endDialog("Vielen Dank %s für die Nutzung des USR III Chatbot. In Kürze wird Sie einer Steuerfachpersonen kontaktieren. Ich wünsche Ihnen einen schönen Tag.", session.privateConversationData.username);
2618
}
2719
]
2820
}

messages/dialogs/askEmail.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

messages/dialogs/askGenericYesNo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ module.exports = {
55
Label: 'Ask Generic Yes No',
66
Dialog: [
77
function (session, args) {
8-
if (session.privateConversationData.usr3questions[session.privateConversationData.currentQuestionKey] !== '') {
8+
// why usr3Questions currentQuestionKey should be empty??????
9+
if (session.privateConversationData.usr3Questions[session.privateConversationData.currentQuestionKey] !== '') {
910
session.endDialog();
1011
} else {
11-
builder.Prompts.choice(session, args.prompt,
12-
['Ja', 'Nein'],
13-
{retryPrompt: "I verstehe nicht. Bitte antworten 'ja' oder 'nein'."});
12+
builder.Prompts.choice(session, args.prompt, "Ja|Nein", {listStyle: 3, retryPrompt: "I verstehe nicht. Bitte antworten 'ja' oder 'nein'."});
1413
}
1514
},
1615
function (session, results) {
1716
if (results.response) {
18-
session.privateConversationData.usr3questions[session.privateConversationData.currentQuestionKey] = results.response.entity == "Ja";
17+
// session.privateConversationData.usr3Questions will have true or false
18+
session.privateConversationData.usr3Questions[session.privateConversationData.currentQuestionKey] = results.response.entity == "Ja";
1919
session.endDialog();
2020
}
2121
}

messages/dialogs/askName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var botbuilder_azure = require("botbuilder-azure");
44
module.exports = {
55
Label: 'Ask name',
66
Dialog: [
7-
function (session) {
7+
function (session, results) {
88
builder.Prompts.text(session, 'Wie lautet Ihre Name?');
99
},
1010
function (session, results) {
1111
if (results.response) {
1212
session.privateConversationData.username = results.response;
13-
session.endDialog("Hallo %s, es freut mich dass Sie den USR III Chatbot nutzen.", session.privateConversationData.username);
13+
session.endDialog("Hallo %s, es freut mich dass Sie den USR III Chatbot nutzen.\n\n\n\nBitte fragen sie mich 'was ist neue steuerreform' oder typpen 'auswirkungen' ein, um zu sehen, was für Auswirkungen die Reform auf Ihre Unternehmen haben kann.", session.privateConversationData.username);
1414
}
1515
}
1616
]

messages/dialogs/askTelephone.js

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var builder = require("botbuilder");
2+
3+
// Dictionaries
4+
var glossaryLookup = require('../glossaryLookup');
5+
var qnaDB = require('../dictionaries/glossary');
6+
7+
var makeCompleteGlossaryArticle = require("../makeCompleteGlossaryArticle");
8+
9+
// global variable to pass states between pieces of the dialog
10+
var argsGlobal = {};
11+
12+
module.exports = {
13+
Label: 'Give single answer',
14+
Dialog: [
15+
/*
16+
To give a single intermediate answer, flow should be as follows
17+
0. A1 is the answer that applies
18+
1. give out usr3AnswersDB[A1Key].longText. It will be like "XYZ applies for your case, would you like to know more?"
19+
2. if answer = 'Ja', then show glossary
20+
- jump out of the dialog
21+
22+
therefore, args should contain:
23+
args =
24+
{
25+
longText: "Möchten Sie wissen, wie sich die aktuellen ordentlichen Steuersätze in den Kantonen voraussichtlich ändern?",
26+
glossary: ["Steuersatzsenkung HL"]
27+
}
28+
29+
we obtain args directly from usr3AnswersDB
30+
*/
31+
function (session, args) {
32+
argsGlobal = args;
33+
// long text provided in args?
34+
if(argsGlobal.longText) {
35+
// show it and ask yes/no to show glossary details
36+
builder.Prompts.choice(session, argsGlobal.longText, "Ja|Nein", {listStyle: 3, retryPrompt: "I verstehe nicht. Bitte antworten 'ja' oder 'nein'."});
37+
}
38+
},
39+
function (session, results) {
40+
// ok, user chose to learn more. are there glossary details?
41+
if (results.response.entity == "Ja" && argsGlobal.glossary && argsGlobal.glossary.length > 0) {
42+
// loop over related glossary records
43+
argsGlobal.glossary.forEach((glossaryRecordKey) => {
44+
if(qnaDB[glossaryRecordKey]) {
45+
// make complete glossary article here
46+
var msg = makeCompleteGlossaryArticle(session, qnaDB[glossaryRecordKey])
47+
session.send(msg);
48+
}
49+
}); // foreach ends
50+
}
51+
else {
52+
// if user chooses not to display glossary details, we can handle this here
53+
}
54+
session.endDialog();
55+
}
56+
]
57+
}

0 commit comments

Comments
 (0)