本文整理汇总了TypeScript中botbuilder.Library类的典型用法代码示例。如果您正苦于以下问题:TypeScript Library类的具体用法?TypeScript Library怎么用?TypeScript Library使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Library类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(instrumentation: BotFrameworkInstrumentation) {
this.instrumentation = instrumentation;
this.library = new Library('faq');
this.library.localePath(path.join(__dirname, '../../../src/bots/faq/locale'));
this.library.dialog('/', faq.createDialog(this));
this.library.dialog('qna', qna.createDialog(this));
}
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:7,代码来源:index.ts
示例2: createLibrary
export function createLibrary(): builder.Library {
return lib.clone();
}
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:3,代码来源:medication-prompt.ts
示例3: async
import * as builder from 'botbuilder';
import openmedicament from "../services/api-openmedicaments";
import openfda from "../services/api-openfda";
let lib = new builder.Library('medication-prompt');
interface ISearchStoredData {
source: string
search: any
};
interface IFdaSearch {
brand_name: string,
id: string,
set_id: string,
version: string
}
const MAX_RESULTS = 10;
/**
* medication-prompt dialog - search into openfda and openmedicament data source
*/
lib.dialog('prompt', [
async (session: builder.Session, args: any, next?: (results?: builder.IDialogResult<any>) => void) => {
let query = args;
let medications = new Array<string>();
try {
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:30,代码来源:medication-prompt.ts
示例4: createLibrary
export function createLibrary() {
return lib.clone();
}
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:3,代码来源:greetings-dialog.ts
示例5: getCardsAttachments
import * as builder from 'botbuilder';
import { SiteUrl } from '../helpers/helper-siteurl';
let lib = new builder.Library('greetings');
lib.dialog('start',
(session: builder.Session, args: any) => {
let cards = getCardsAttachments(session);
if (args === 'default') {
session.send("greetings_lost");
} else {
session.send("greetings_details_firstline");
session.send("greetings_details_secondline");
}
// Create reply with Carousel AttachmentLayout
var message = new builder.Message(session)
.text("greetings_welcome")
.attachmentLayout(builder.AttachmentLayout.carousel)
.attachments(cards);
session.send(message);
session.endDialog(); // <--- DON'T FORGET TO END THE DIALOG
});
export function getCardsAttachments(session: builder.Session) {
return [
new builder.HeroCard(session)
.title(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_title_findplace', "greetings"))
.subtitle(session.localizer.gettext(session.preferredLocale(), 'greetings_menu_subtitletitle_findplace', "greetings"))
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:31,代码来源:greetings-dialog.ts
示例6: require
import * as builder from 'botbuilder';
import { ListStyle, IEntity } from 'botbuilder'
import spatialData, { EntityType, SpatialData } from "../services/api-bingspatialdata";
let locationDialog = require('botbuilder-location');
let lib = new builder.Library('places');
// Extends IEntity interface to support entity resolution.
declare interface IEntityEx extends builder.IEntity {
resolution: any;
}
// Data interface that will be saved in the dialog states
interface IStoredData {
type: string
location: any
}
// Dialog triggered on Intent.FindPlace (ex. Find a Pharmacy in Paris)
lib.dialog('findplace', [
(session: builder.Session, args: any, next?: (results?: builder.IDialogResult<any>) => void) => {
let place: IStoredData;
let heathplace: boolean = false
if (args && args.intent) {
let intent = args.intent;
// Get Place.Type and Place.Location entities
let typeEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Place.Type') as IEntityEx;
let locationEntity: IEntityEx = builder.EntityRecognizer.findEntity(intent.entities, 'Place.Location') as IEntityEx;
place = session.dialogData.place = {
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:31,代码来源:findplace-dialog.ts
示例7: require
import * as builder from 'botbuilder';
import openmedicament, { Medication, MedicationCode } from "../services/api-openmedicaments";
import openfda, { Result } from "../services/api-openfda";
import translator from "../services/cognitive-translator";
import medicationcard from "../cards/medication-card";
import countrydata from '../helpers/helper-countrydata';
let turndownService = require('turndown');
let languages = require('country-data').languages;
let lib = new builder.Library('medication');
// Extends IEntity interface to support entity resolution.
declare interface IEntityEx extends builder.IEntity {
resolution: any;
}
interface IInformationStoredData {
name: string,
type: string
}
interface ITranslateStoredData {
name: string
language?: string
languageCode?: string
country?: string,
countryCode?: string,
drugdetails?: any
}
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:30,代码来源:medication-dialog.ts
示例8: async
import * as builder from 'botbuilder';
import {ListStyle} from 'botbuilder';
import vision from '../services/cognitive-Vision';
import custom from '../services/cognitive-CustomVision';
import attachment from "../helpers/helper-attachment";
import translator from "../services/cognitive-translator";
import countrydata from '../helpers/helper-countrydata';
let lib = new builder.Library('image');
let image: Buffer | undefined = undefined;
lib.dialog('detection', [
async (session: builder.Session, args: any, next?: (results?: builder.IDialogResult<any>) => void) => {
session.send("Image received. Analysis in progress.");
session.sendTyping();
if (attachment.hasImageAttachment(session.message)) {
image = undefined;
image = await attachment.getImageFromMessageAsync(session.message, session.connector);
if (!image) {
return session.endDialog("Not able to get the image you sent, sorry :(");
}
let isMedicineImage = await custom.isMedicineImage(image);
if (!isMedicineImage) {
let caption = await vision.getCaptionFromImageAsync(image);
return session.endDialog(`This image is not medicine package. It seems ${caption}.`);
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:31,代码来源:imagedetection-dialog.ts
示例9: require
import * as builder from 'botbuilder';
import countrydata from '../helpers/helper-countrydata';
let lib = new builder.Library('country-prompt');
let languages = require('country-data').languages;
lib.dialog('prompt', [
(session: builder.Session, results: any, next?: (results?: builder.IDialogResult<any>) => void) => {
// Prompt the user for a country
builder.Prompts.text(session, "drugs_country_prompt");
},
(session: builder.Session, results: any, next?: (results?: builder.IDialogResult<any>) => void) => {
if (results && results.response) {
let searchCountry = countrydata.getCountryByName(results.response);
if (searchCountry) {
let result = {
country: searchCountry.name,
countryCode: searchCountry.alpha2
};
return session.endDialogWithResult({ response: result });
}
}
session.send("drugs_default_country");
return session.replaceDialog("prompt");
}
]);
export function createLibrary(): builder.Library {
return lib.clone();
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:31,代码来源:country-prompt.ts
注:本文中的botbuilder.Library类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论