微软QnA制造商 – 欢迎消息循环

我正试图实现类似于这个主题已经完成的东西开始对话与QnA Maker机器人框架识别器(节点JS)

这个build议是根据机器人首先发送一个欢迎消息,然后等待问题。 然而现在的机器人说'Hj! 我该怎么帮你?“,等待问题,然后再次回到欢迎。

就像是

A:嗨! 我怎么帮你? 问:汽车维修的电话号码是什么?答:致电500-XXXX等。问:假期期间我应该联系谁? A:嗨! 我怎么帮你?

我玩beginDialog,结束对话,取代对话..但是没有运气。

这是最新的代码。

bot.dialog('/', [ function (session ) { session.beginDialog('/welcome'); }, function (session) { session.beginDialog('/qna'); } ]) ; bot.dialog('/welcome', [ function (session) { // Send a greeting and show help. builder.Prompts.text(session, "Hi! How can I help you?"); // session.endDialog(); } ]); bot.dialog('/qna', basicQnAMakerDialog ) ; 

下面是一个代码示例,展示了如何侦听新用户连接到机器人时触发的conversationUpdate事件。 又名“欢迎辞”:

 // Listen for 'conversationUpdate' event to detect members joining conversation. bot.on('conversationUpdate', function (message) { if (message.membersAdded) { message.membersAdded.forEach(function (identity) { if (identity.id == message.address.bot.id) { // Bot is joining conversation // - For WebChat channel you'll get this on page load. var reply = new builder.Message() .address(message.address) .text("Welcome to my page"); bot.send(reply); } else { // User is joining conversation // - For WebChat channel this will be sent when user sends first message. // - When a user joins a conversation the address.user field is often for // essentially a system account so to ensure we're targeting the right // user we can tweek the address object to reference the joining user. // - If we wanted to send a private message to teh joining user we could // delete the address.conversation field from the cloned address. var address = Object.create(message.address); address.user = identity; var reply = new builder.Message() .address(address) .text("Hello %s", identity.name); bot.send(reply); } }); } });