本文整理汇总了TypeScript中botbuilder.LuisDialog类的典型用法代码示例。如果您正苦于以下问题:TypeScript LuisDialog类的具体用法?TypeScript LuisDialog怎么用?TypeScript LuisDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LuisDialog类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
function (session, results) {
builder.LuisDialog.recognize(session.message.text, modelUri, function (err, intents, entities) {
if (null != err) {
session.endDialog("Unexpected error while parsing your answer. Try again after sometime!");
return;
}
session.userData.nameAlreadyAsked = true;
var entity = builder.EntityRecognizer.findEntity(entities, 'name');
if (null != entity) {
session.userData.name = entity.entity;
session.beginDialog("/showOffer");
}
else {
session.send("I am sorry, i did not understand your answser. Please provide your name again.");
//session.replaceDialog("/userProfile");
}
});
}
示例3: require
/// <reference path="typings/tsd.d.ts" />
const fs = require('fs');
const restify = require('restify');
const skype = require('skype-sdk');
const builder = require('botbuilder');
import stockClient = require('./stockclient');
import luisclient = require('./luis-client');
var luisBaseUrl = "https://api.projectoxford.ai/luis/v1/application";
var applicationId = "<LUIS APPLICATION ID>";
var subscriptionKey = "<SUBSCIPTION KEY>";
var model = process.env.model || `${luisBaseUrl}?id=${applicationId}&subscription-key=${subscriptionKey}&q=`;
var dialog = new builder.LuisDialog(model);
const botService = new skype.BotService({
messaging: {
botId: process.env.BOT_ID || "64509262-bbb5-468b-bbc3-9d48cf11791d",
serverUrl: "https://apis.skype.com",
requestTimeout: 15000,
appId: process.env.APP_ID || "30a5ed7b-8880-4025-b765-50094b992afc",
appSecret: process.env.APP_SECRET || "<APP KEY>"
}
});
// Create bot and add dialogs
var skypebot = new builder.SkypeBot(botService);
var textbot = new builder.TextBot(botService);
skypebot.add('/', dialog);
textbot.add('/', dialog);
示例4: require
let prompts = require('../prompts');
import { IRouteProvider, RouteList, Route, LuisLocation } from '../lib/interfaces';
import { RejseplanenRoutesProvider } from '../lib/rejseplanen';
import { GoogleMapsRoutesProvider } from '../lib/googlemaps';
let providers = {
google: new GoogleMapsRoutesProvider({key: process.env.GOOGLE_MAPS_KEY}),
rejseplanen: new RejseplanenRoutesProvider(process.env.REJSEPLANEN_BASE_URL)
}
// let googleProvider: IRouteProvider = new GoogleMapsRoutesProvider({key: process.env.GOOGLE_MAPS_KEY});
// let rejseplanenProvider: IRouteProvider = new RejseplanenRoutesProvider(process.env.REJSEPLANEN_BASE_URL);
// let routeProvider = googleProvider;
/** Return a LuisDialog that points at our model and then add intent handlers. */
let model = process.env.LUIS_AI_MODEL
let luisDialog = new builder.LuisDialog(model);
module.exports = luisDialog;
/** Answer users help requests. We can use a DialogAction to send a static message. */
// luisDialog.on('None', function(session) {
// console.log('Intent Triggered: None')
// session.send(prompts.helpMessage);
// });
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.")
示例5: function
/*proxy = http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:80
http - proxy=http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:8080
https - proxy=http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:8080
process.env.proxy = "http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:80";
process.env.http_proxy = "http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:80";
process.env.https_proxy = "http://v631754:glAbundance03g$@proxy.ebiz.verizon.com:8080";
globalTunnel.initialize();
*/
var model = process.env.model || "https://api.projectoxford.ai/luis/v1/application?id=573c0d0c-060c-4549-8ef5-650218618c08&subscription-key=b27a7109bc1046fb9cc7cfa874e3f819&q=";
var modelUri = "https://api.projectoxford.ai/luis/v1/application?id=573c0d0c-060c-4549-8ef5-650218618c08&subscription-key=b27a7109bc1046fb9cc7cfa874e3f819";
var dialog = new builder.LuisDialog(model);
var bot = new builder.BotConnectorBot(); //new builder.TextBot();
//globalTunnel.end();
//start with waterfall...
bot.add("/", [
function (session, args, next) {
if (session.message.text.indexOf("set tv package") == -1) {
if (!session.userData.channelSearchResultsShown) {
if (null == session.userData.selectedPackageName || session.userData.selectedPackageName.length == 0) {
session.userData.selectedPackageName = fiosTVPackages["custom_tv_essentials"];
}
var packageInfo = "Your current TV package selection is " + session.userData.selectedPackageName;
builder.Prompts.confirm(session, packageInfo + "<br/>Are you looking for any specific channels in your package?");
}
示例6: require
ďťż/*-----------------------------------------------------------------------------
This is a sample bot.
@author: giriganapathy
@since: May 5, 2016 01:32 PM
-----------------------------------------------------------------------------*/
var restify = require("restify");
var builder = require("botbuilder");
var model = process.env.model || "https://api.projectoxford.ai/luis/v1/application?id=83b0d263-bcb7-4ded-b197-95b25ee68030&subscription-key=b27a7109bc1046fb9cc7cfa874e3f819&q=";
var key = "embct6154";
var dialog = new builder.LuisDialog(model);
var bot = new builder.BotConnectorBot();//new builder.TextBot();
bot.add("/", dialog);
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" }
};