Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ex3 nodejs #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Node/exercise3-LuisDialog/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ server.post('/api/messages', connector.listen());
var bot = new builder.UniversalBot(connector, (session, args, next) => {
session.endDialog(`I'm sorry, I did not understand '${session.message.text}'.\nType 'help' to know more about me :)`);
});

var luisRecognizer = new builder.LuisRecognizer(process.env.LUIS_MODEL_URL).onEnabled(function (context, callback) {
var enabled = context.dialogStack().length === 0;
callback(null, enabled);
Expand All @@ -39,16 +38,17 @@ bot.recognizer(luisRecognizer);

bot.dialog('Help',
(session, args, next) => {
session.endDialog(`I'm the help desk bot and I can help you create a ticket.\n` +
session.send(`I'm the help desk bot and I can help you create a ticket.\n` +
`You can tell me things like _I need to reset my password_ or _I cannot print_.`);
builder.Prompts.text(session, 'First, please briefly describe your problem to me.');
session.endDialog('First, please briefly describe your problem to me.');
}
).triggerAction({
matches: 'Help'
});

bot.dialog('SubmitTicket', [
(session, args, next) => {

var category = builder.EntityRecognizer.findEntity(args.intent.entities, 'category');
var severity = builder.EntityRecognizer.findEntity(args.intent.entities, 'severity');

Expand Down Expand Up @@ -122,7 +122,6 @@ bot.dialog('SubmitTicket', [

const createCard = (ticketId, data) => {
var cardTxt = fs.readFileSync('./cards/ticket.json', 'UTF-8');

cardTxt = cardTxt.replace(/{ticketId}/g, ticketId)
.replace(/{severity}/g, data.severity)
.replace(/{category}/g, data.category)
Expand Down