本文整理汇总了TypeScript中botbuilder.LuisDialog.on方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LuisDialog.on方法的具体用法?TypeScript LuisDialog.on怎么用?TypeScript LuisDialog.on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botbuilder.LuisDialog
的用法示例。
在下文中一共展示了LuisDialog.on方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addDialogs
addDialogs() {
let dialog = new LuisDialog(this.luisUrl);
console.log('dialog is ', dialog);
this.bot.add('/', dialog);
dialog.on('FindItemLevel', [
this.processLanguage,
this.getCharacterName,
this.getRealm,
this.getIlvl
]);
dialog.onDefault(DialogAction.send("I could not understand your request."));
}
示例2: function
// bot.reply(JSON.stringify(call), true);
// })
skypebot.on('onIncomingCall', function (call){
console.log(JSON.stringify(call));
skypebot.reply(JSON.stringify(call), true);
});
dialog.on("Greeting", function(session, args) {
var greetings = [
"Hi there!",
"Hello ",
"Hola",
"Hallo",
"Hi",
"Hello there!"
];
var i = Math.round(Math.random() * (greetings.length - 1));
session.send(`${greetings[i]}!.`);
session.send(`How can i help you?`);
});
dialog.on("GetStockQuote", [
function(session, args, next) {
console.log("args :: \n" + JSON.stringify(args.entities));
var symbol = builder.EntityRecognizer.findEntity(args.entities, 'company');
if (!symbol) {
builder.Prompts.text(session, "Which company stock you are intrested in?");
} else {
示例3: function
dialog.on("intent-change-tv-package", [
function (session, args) {
//session.userData.selectedPackageName = "Custom TV Essentials";
//session.send("From:" + session.message.from.channelId);
var entity = builder.EntityRecognizer.findEntity(args.entities, 'tv-package-name');
if (null != entity) {
var tvPackageName = entity.entity;
if (null != tvPackageName) {
tvPackageName = tvPackageName.replace(/\s+/g, '');
if (session.userData.selectedPackageName != fiosTVPackages[tvPackageName]) {
session.userData.selectedPackageName = fiosTVPackages[tvPackageName];
//session.send("Your current selection: " + session.userData.selectedPackageName);
var packageInfo = "Your current selection: " + session.userData.selectedPackageName;
builder.Prompts.confirm(session, packageInfo + "<br/>Are you looking for any specific channels in your package?");
}
}
}
},
function (session, results, next) {
if (true === results.response) {
session.userData.channelSearchResultsShown = false;
builder.Prompts.text(session, "Hey .. thatâs cool.. Can i have the channel names which you are looking for?");
}
else {
delete session.userData.channelSearchResultsShown;
session.endDialog("Thanks! Say 'Hi', if you want to chat with me again...");
}
},
function (session, results, next) {
if (results.response) {
session.beginDialog('/query-package-luis');
}
else {
session.send("Sorry! i did not understand. Could you please provide me the channel name again 5?");
}
}
]);
示例4: if
// });
luisDialog.onDefault((session) => {
if (session.message.text.toLowerCase().indexOf('google') != -1) {
session.userData.routeProvider = 'google';
session.send("Ok, I'll use google.");
} else if (session.message.text.toLowerCase().indexOf('rejseplanen') != -1) {
session.userData.routeProvider = 'rejseplanen';
session.send("Ok, I'll use rejseplanen.")
} else {
session.send(prompts.helpMessage);
}
});
luisDialog.on('error', function(message) {
console.error(message);
});
/** Prompts a user for the title of the task and saves it. */
luisDialog.on('FindRoute', [
function (session, args, next) {
console.log('Intent Triggered: FindRoute');
// See if got the tasks title from our LUIS model.
let luisLocations = sortLocations(args);
if (luisLocations.length != 2) {
// TODO: Do something better
console.log('FindRoute: Did not find 2 locations')
session.send(prompts.routeRequestNotUnderstood);
} else {
let originLuisLocation = luisLocations[0];
示例5: function
dialog.on("intent.pnr.enquiry", [
function (session, args, next) {
var entity = builder.EntityRecognizer.findEntity(args.entities, 'pnr-number');
if (null != entity) {
var pnrNumber = entity.entity;
if (null != pnrNumber) {
session.userData.pnrNumber = pnrNumber;
var Client = require('node-rest-client').Client;
var client = new Client();
// set content-type header and data as json in args parameter
var options = {
headers: { "Content-Type": "application/json" }
};
client.get("http://api.railwayapi.com/pnr_status/pnr/" + session.userData.pnrNumber + "/apikey/" + key, options, function (data, response) {
// parsed response body as js object
if (data) {
var resultInfo = "\nTrain Name: " + data["train_name"] +
"\nFrom Station: " + data["from_station"]["name"] +
"\To Station: " + data["to_station"]["name"] +
"\Date Of Journey: " + data["doj"];
session.send(resultInfo);
//var msg = "Wow.. Thatâs a FiOS available location...\n\nLet me ask you few usage questions to help you select suitable Fios package.\n\n" +
// "How many devices does your family connect to the Internet such as: cell phone, tablet, laptop, Smart TV, etc.? Also, do you do any gaming or stream any videos?"
//builder.Prompts.text(session, msg);
}
else {
session.send("Sorry! Information not available...");
delete session.userData.pnrNumber
}
});
}
else {
session.send("Please provide your PNR Number...");
}
}
else {
session.send("Please provide your PNR Number...");
}
}
]);