mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-28 21:02:08 +00:00
fix(web): Fix auto-scroll issue in chat dashboard
This commit is contained in:
parent
af9d631076
commit
8cb0e1ecf0
@ -226,10 +226,12 @@ const ChatContainer = () => {
|
||||
})}
|
||||
>
|
||||
{/* Wrap the Completion component in a container with a specific height */}
|
||||
<div className={classNames('h-full', {
|
||||
'overflow-hidden': scene !== 'chat_dashboard',
|
||||
'flex flex-col': scene === 'chat_dashboard'
|
||||
})}>
|
||||
<div
|
||||
className={classNames('h-full', {
|
||||
'overflow-hidden': scene !== 'chat_dashboard',
|
||||
'flex flex-col': scene === 'chat_dashboard',
|
||||
})}
|
||||
>
|
||||
<Completion messages={history} onSubmit={handleChat} onFormatContent={formatToVisThinking} />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -165,7 +165,7 @@ const Completion = ({ messages, onSubmit, onFormatContent }: Props) => {
|
||||
});
|
||||
}
|
||||
setShowMessages(tempMessage.filter(item => ['view', 'human'].includes(item.role)));
|
||||
}, [isChartChat, messages, onFormatContent]);
|
||||
}, [isChartChat, messages, onFormatContent, processMessageContent]);
|
||||
|
||||
useEffect(() => {
|
||||
apiInterceptors(getChatFeedBackSelect())
|
||||
@ -194,7 +194,6 @@ const Completion = ({ messages, onSubmit, onFormatContent }: Props) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Use multiple timeouts to ensure scrolling works even with dynamic content
|
||||
setTimeout(scrollToBottom, 50);
|
||||
setTimeout(scrollToBottom, 200);
|
||||
@ -212,10 +211,13 @@ const Completion = ({ messages, onSubmit, onFormatContent }: Props) => {
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<div ref={scrollableRef} className={classNames('flex flex-1 overflow-y-auto w-full flex-col', {
|
||||
'h-full': scene !== 'chat_dashboard',
|
||||
'flex-1 min-h-0': scene === 'chat_dashboard'
|
||||
})}>
|
||||
<div
|
||||
ref={scrollableRef}
|
||||
className={classNames('flex flex-1 overflow-y-auto w-full flex-col', {
|
||||
'h-full': scene !== 'chat_dashboard',
|
||||
'flex-1 min-h-0': scene === 'chat_dashboard',
|
||||
})}
|
||||
>
|
||||
<div className='flex items-center flex-1 flex-col text-sm leading-6 text-slate-900 dark:text-slate-300 sm:text-base sm:leading-7'>
|
||||
{showMessages.length ? (
|
||||
showMessages.map((content, index) => {
|
||||
|
Loading…
Reference in New Issue
Block a user