Microsoft Bot Framework

时间:2018-02-18 10:41:03

标签: botframework

我正在努力建立一个对话机器人。当我试图通过下一个传递响应时,它没有被反射下一个功能。

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'
})

1 个答案:

答案 0 :(得分:1)

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

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

尝试:

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'
})