【问题标题】:Microsoft Bot Framework微软机器人框架
【发布时间】:2018-02-18 10:41:02
【问题描述】:

我正在尝试构建一个会话机器人。当我试图通过 next 传递响应时,它不会在下一个函数中反映出来。

bot.dialog('Barcode',
    (session, args, next) => {
        var intent = args.intent;
        var id = builder.EntityRecognizer.findEntity(intent.entities, 'Report.Id');
          if (id) {
            next({ response: id.entity });

        } else {
            builder.Prompts.text(session, 'Please enter your id');
        }
      session.endDialog();
    }  ,
      (session,results) => {

          var id = results.response;
           session.send(id.toString());  -- i want the value to be passed here 
      }
).triggerAction({
    matches: 'Barcode'
})

【问题讨论】:

    标签: botframework


    【解决方案1】:

    如果要在对话框中实现工作流,可以在dialog()函数的第二个参数中设置IDialogWaterfallStep|IDialogWaterfallStep[]

    在您的代码中,您忘记在步骤之外覆盖[]

    试试:

    bot.dialog('Barcode',[
        (session, args, next) => {
            var intent = args.intent;
            var id = builder.EntityRecognizer.findEntity(intent.entities, 'Report.Id');
              if (id) {
                next({ response: id.entity });
    
            } else {
                builder.Prompts.text(session, 'Please enter your id');
            }
          session.endDialog();
        }  ,
          (session,results) => {
    
              var id = results.response;
               session.send(id.toString());  -- i want the value to be passed here 
          }]
    ).triggerAction({
        matches: 'Barcode'
    })
    

    【讨论】:

      猜你喜欢
      • 2017-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-31
      • 2018-11-04
      • 2020-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多