Bot Framework Emulator处理新成员与Bot Framework Webchat是否有所不同? [英] Is the Bot Framework Emulator handling new members differently from Bot Framework Webchat?

查看:78
本文介绍了Bot Framework Emulator处理新成员与Bot Framework Webchat是否有所不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此官方示例项目( https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/typescript_nodejs/13.core-bot/src/bots/dialogAndWelcomeBot.ts ),我可以标识新成员并使用以下代码(我的代码)向他们发送欢迎消息:

According to this official sample project (https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/typescript_nodejs/13.core-bot/src/bots/dialogAndWelcomeBot.ts) I can identity new members and send them a welcome message using this (my code):

this.onMembersAdded(async (context) => {
   const welcomeCardTemplate = require("../lib/data/resources/cards/welcomeCard.json");
      const membersAdded = context.activity.membersAdded;
      for (const member of membersAdded) {
         if (member.id !== context.activity.recipient.id) {
            const welcomeCard = CardFactory.adaptiveCard(welcomeCardTemplate );
            await context.sendActivity({ attachments: [welcomeCard] });
         }
      }
   });

使用仿真器时效果很好.连接到聊天室后,我立即收到欢迎消息,但是在Azure或WebChat上使用聊天室时,直到我第一次在聊天室中输入某种文本输入时,它才被触发.

It works great when using the emulator. As soon as I connect to the chat I get my welcome message, but when using the Chat on Azure or the WebChat it's not triggered until I first enter some kind of text input to the chat.

我注意到的一件事是,当我使用模拟器时,一旦我连接到聊天室,就会有两个活动被发送到bot,一个活动包含了该bot的ID,另一个包含了该用户的ID,但是当使用其他聊天选项(Azure聊天和WebChat)时,仅发送一个活动(memberId与收件人ID相同),因此它永远不会超出if语句.

One thing I noticed is that when I'm using the emulator two activities are sent to the bot as soon as I connect to the chat, one that contains the Id of the bot and one that contains the Id of the user but when using the other chat options (Azure Chat and WebChat) only one activity is being sent (where the memberId is the same as the recipientId) so it never goes past the if-statement.

我在这里缺少什么,为什么从Azure聊天和WebChat仅发送一项活动?

What am I missing here, why is only one activity being sent from the Azure Chat and WebChat?

推荐答案

这时,在某些情况下(如您描述的情况),WebChat和DirectLine的行为与模拟器不同.对于这种特殊情况,您可以找到一个公开问题,您可以在其中找到更多信息.

At this time, WebChat and DirectLine behaves differently from the emulator in certain scenarios like the one you describe. There is an open issue for this particular situation where you can find more information.

如问题中所述,

As stated in the issue, there is a workaround to force the ConversationUpdate event which you can try and test if it suits your needs (I haven't tried myself).

这篇关于Bot Framework Emulator处理新成员与Bot Framework Webchat是否有所不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆