作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在 chatBot(Microsoft Bot Framework)处理任何请求时显示“sendTypingIndicator”。我添加了 sendTypingIndicator: true
和 sendTyping: true
但它仍然没有显示任何动画,我在 Microsoft 文档中搜索但没有找到任何具体内容。这就是我所拥有的:
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: conversationInfo.token,
}),
store: store,
styleOptions,
sendTypingIndicator: true,
sendTyping: true
},
document.getElementById("powerVAwebchat")
);
有没有办法自动为所有请求添加打字动画,或者我是否必须为每个请求动态添加它?您能指导我找到解决方案吗?
谢谢
最佳答案
因此,您需要的是在收到消息请求时从机器人发送打字事件。
ShowTypingMiddleware
中间件就可以做到这一点。
您只需将其添加到适配器中,如下所示:
public class AdapterWithErrorHandler : BotFrameworkHttpAdapter
{
public AdapterWithErrorHandler(
IConfiguration configuration,
ILogger<BotFrameworkHttpAdapter> logger,
IStorage storage,
UserState userState,
ConversationState conversationState)
: base(configuration, logger)
{
Use(new ShowTypingMiddleware());
//...
}
}
请注意,如果机器人回复“快”,您将不会在聊天中看到打字指示器。您始终可以模拟它,例如,在机器人中添加 await Task.Delay(5000)
。
关于azure - 当 Microsoft Bot 处理任何请求时显示 "TypingIndicator",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67391534/
我试图在 chatBot(Microsoft Bot Framework)处理任何请求时显示“sendTypingIndicator”。我添加了 sendTypingIndicator: true 和
我试图在 chatBot(Microsoft Bot Framework)处理任何请求时显示“sendTypingIndicator”。我添加了 sendTypingIndicator: true 和
我是一名优秀的程序员,十分优秀!