当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript botbuilder.Prompts类代码示例

本文整理汇总了TypeScript中botbuilder.Prompts的典型用法代码示例。如果您正苦于以下问题:TypeScript Prompts类的具体用法?TypeScript Prompts怎么用?TypeScript Prompts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Prompts类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

    (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 = {
                type: typeEntity ? typeEntity.resolution.values[0] : undefined,
                location: locationEntity ? locationEntity.entity : undefined,
            };

            // We want to manage only medical places
            heathplace = place.type == 'hospital' || place.type == 'pharmacy';
        }

        if (!heathplace) {
            builder.Prompts.choice(session, "choice_prompt", "hospital|pharmacy", { listStyle: ListStyle.button });
        }
        else {
            if (next) return next();
        }
    },
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:26,代码来源:findplace-dialog.ts

示例2: RegExp

    (session: builder.Session, results: any, next?: (results?: builder.IDialogResult<any>) => void) => {

        let userAnswer : string = results.response;
        let pattern = new RegExp(/^unknown/i );
        let matches = userAnswer.match(pattern);

        if (matches) {
            return session.endDialogWithResult({ response: "unknown" })
        }

        if (results && results.response) {
            let searchLanguage = countrydata.getVisionLanguageByName(results.response);

            if (searchLanguage && searchLanguage.length == 1) {
                let result = {
                    language: searchLanguage[0].name,
                    languageCode: searchLanguage[0].code
                };

                return session.endDialogWithResult({ response: result });
            } else if (searchLanguage && searchLanguage.length > 1) {

                let choices = new Array<string>();
                searchLanguage.forEach(element => {
                    choices.push(element.name);
                });

                return builder.Prompts.choice(session, "Please select an option:", choices, {listStyle : ListStyle.button})
            }
        }

        session.send("image_default_language");
        return session.replaceDialog("language-dialog");
    },
开发者ID:LucasChies,项目名称:Medication-Helper-idtpoa,代码行数:34,代码来源:imagedetection-dialog.ts

示例3: function

 function (session, args, next) {
     if (!session.userData.nameAlreadyAsked) {
         builder.Prompts.text(session, "May i know your name please?");
     }
     else {
         next();
     }
 },
开发者ID:giriganapathy,项目名称:VZChatBotApp,代码行数:8,代码来源:server.ts

示例4:

        (session, args, next) => {
            const botName = '<%= botName %>';
            const description = `<%= botDescription %>`;

            session.send(`Hi there! I'm ${botName}`);
            session.send(`In a nutshell, here's what I can do:\n\n${description}`);

            builder.Prompts.text(session, `What's your name?`);
        },
开发者ID:kalappaBadiger,项目名称:BotBuilder,代码行数:9,代码来源:echo.ts

示例5: function

 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 {
         next({ response: symbol.entity });
     }
 },
开发者ID:plkumar,项目名称:StockBot,代码行数:9,代码来源:server.ts

示例6: function

                function (session, args) {
					var qnaMakerResult = args as IQnAMakerResults;
                    session.dialogData.qnaMakerResult = qnaMakerResult;
                    var questionOptions: string[] = [];
        			qnaMakerResult.answers.forEach(function (qna: IQnAMakerResult) { questionOptions.push(qna.questions[0]); });
                    questionOptions.push("None of the above.");
                    var promptOptions: builder.IPromptOptions = {listStyle: builder.ListStyle.button, maxRetries: 0};
                	builder.Prompts.choice(session,  "Did you mean:", questionOptions, promptOptions);
                },
开发者ID:jpancorb,项目名称:BotBuilder-CognitiveServices,代码行数:9,代码来源:QnAMakerTools.ts

示例7: next

 (session: Session, luisResults: IIntentRecognizerResult, next: (results?: IDialogResult<any>) => void) => {
     const languageEntity = EntityRecognizer.findEntity(luisResults.entities, 'language');
     const language = languageEntity && languageEntity.entity;
     if (!language) {
         Prompts.choice(session, 'master.languageSelection', Object.keys(languages),
             { listStyle: ListStyle.button, maxRetries: 3, retryPrompt: 'master.retryLanguageSelection' });
     } else {
         next({ response: { entity: language }});
     }
 },
开发者ID:magencio,项目名称:UberBotNode_V3,代码行数:10,代码来源:masterDialog.ts

示例8: function

 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...");
     }
 },
开发者ID:giriganapathy,项目名称:FiOSPackageHelper,代码行数:10,代码来源:server.ts

示例9: function

 function(session: any) {
     if(this.criteria["type"] === "choice"){
         var choices:any = [];
         for(var choice of this.criteria["choices"]){
             choices.push(choice.value);
         }
         builder.Prompts.choice(session, this.criteria["question"], choices);
     }
     //https://docs.botframework.com/en-us/node/builder/chat-reference/classes/_botbuilder_d_.luisrecognizer.html
     else {
         builder.Prompts[this.criteria["type"]](session, this.criteria["question"], null );
     }
 }, function(session: any, results: any) {
开发者ID:DXFrance,项目名称:botretail,代码行数:13,代码来源:retailbot.dialogsManager.ts


注:本文中的botbuilder.Prompts类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。