如何使用React.js在Botframework v4聊天应用程序中执行Send'Typing指示符? [英] How to perform Send 'Typing indicator in Botframework v4 chat application using React.js?

查看:167
本文介绍了如何使用React.js在Botframework v4聊天应用程序中执行Send'Typing指示符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用botframework v4构建一个聊天应用程序,并以React.js为前端,以.net核心为后端来生成令牌。我想使用react在我的聊天中实现 Typing ..指示器。使用

I'm building a chat application using botframework v4 with React.js as front-end and .net core as back-end to generate token. I want to implement "Typing.." indicator to my chat using react. Tried using

  window.WebChat.renderWebChat({
  directLine: window.WebChat.createDirectLine({ token }),

  sendTypingIndicator: true,

  }, document.getElementById('webchat'));

/tree/master/samples/05.custom-components/b.send-typing-indicator rel = nofollow noreferrer> https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/05。 custom-components / b.send-typing-indicator
,但是没有用。寻找解决方案。

as mentioned in https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/05.custom-components/b.send-typing-indicator but it didn't worked. Looking for a solution for this.

推荐答案

通过启用 sendTypingIndicator 将输入事件从用户发送到您的机器人。看来您想反过来做。

By enabling sendTypingIndicator you are sending typing events from the user to your bot. It looks like you would like to do it the other way around.

通过发送 ActivityTypes.Typing (输入),您将在WebChat(或其他受支持的频道)中触发输入指示器。延迟活动是可选的,但可用于确保邮件不会立即发送。

By sending an activity of the type ActivityTypes.Typing (typing), you will trigger a typing indicator in the WebChat (or other supported channels). The delay activity is optional, but could be used to make sure the message isn't send instantly.

await turnContext.SendActivitiesAsync(
            new Activity[] {
                new Activity { Type = ActivityTypes.Typing },
                new Activity { Type = "delay", Value= 3000 },
                MessageFactory.Text("Finished typing", "Finished typing"),
            },
            cancellationToken);

来源:发送打字指示符

这篇关于如何使用React.js在Botframework v4聊天应用程序中执行Send'Typing指示符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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