“自动滚动"不适用于Microsoft Bot框架(基于Python SDK) [英] 'Auto scroll' not working On Microsoft-bot-Framework (Python SDK based)
问题描述
我对Microsoft-botframework有一些疑问.
I have some issue about microsoft-botframework.
我使用Microsoft-botframework Python SDK创建了一个聊天机器人.
I made a chatbot using microsoft-botframework Python SDK.
所以我将其部署为Webchat,并将其附加在我的网站Wordpress上.
So I deploy it as Webchat , I attached this on my website, Wordpress.
但是,卡上自动滚动功能不起作用.
出现新卡时,自动滚动不起作用.
When new card appear, Auto scroll doesn't working.
这是我的关键问题,我真的希望有人帮忙.
So this is my critical Issue and I really want someone help.
谢谢.
推荐答案
这是已知的问题.有一种解决方法,您可以使用自定义WebChat活动中间件,当聊天窗口收到新消息时,该中间件会将最后一条消息滚动到视图中.看看下面的代码片段.
This is a known issue in WebChat. There is a work around where you can use a custom WebChat Activity Middleware that scrolls the last message into view when the chat window receives a new message. Take a look at the code snippet below.
const store = window.WebChat.createStore(
{},
({ dispatch }) => next => action => {
if (action.type === 'DIRECT_LINE/POST_ACTIVITY_FULFILLED') {
document.querySelector('ul[role="list"]').lastChild.scrollIntoView({behavior: 'smooth', block: 'start'});
}
return next(action);
}
);
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token }),
store
}, document.getElementById('webchat'));
希望这会有所帮助!
这篇关于“自动滚动"不适用于Microsoft Bot框架(基于Python SDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!