我正在使用 botframework v4 构建一个聊天应用程序,以 React.js 作为前端,以 .net 核心作为后端来生成 token 。我想使用 React 在我的聊天中实现“Typing..”指示器。尝试使用
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token }),
sendTypingIndicator: true,
}, document.getElementById('webchat'));
如 https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/05.custom-components/b.send-typing-indicator 中所述 但它没有用。正在为此寻找解决方案。
最佳答案
通过启用 sendTypingIndicator
,您可以将输入事件从用户发送到您的机器人。看来您想反过来做。
通过发送 ActivityTypes.Typing
类型的事件(打字),您将在 WebChat(或其他支持的 channel )中触发打字指示器。延迟事件是可选的,但可用于确保消息不会立即发送。
await turnContext.SendActivitiesAsync(
new Activity[] {
new Activity { Type = ActivityTypes.Typing },
new Activity { Type = "delay", Value= 3000 },
MessageFactory.Text("Finished typing", "Finished typing"),
},
cancellationToken);
关于reactjs - 如何使用 React.js 在 Botframework v4 聊天应用程序中执行发送“键入指示器”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60389745/