diff --git a/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx b/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx index 755436f90c..76bd8c730d 100644 --- a/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx +++ b/react/src/components/lablupTalkativotUI/VirtualChatMessageList.tsx @@ -81,44 +81,48 @@ const VirtualChatMessageList: React.FC<VirtualizedListProps> = ({ overscan={overscan} ref={virtuosoRef} /> - <div - style={{ - position: 'absolute', - right: '50%', - transform: 'translateX(+50%)', - bottom: token.marginSM, - opacity: atBottom ? 0 : 1, - transition: 'opacity 0.2s', - transitionDelay: atBottom ? '0s' : '0.2s', - }} - > - <ScrollBottomHandlerButton - atBottom={atBottom} - autoScroll={isStreaming} - onScrollToBottom={(type) => { - const virtuoso = virtuosoRef.current; - switch (type) { - case 'auto': { - virtuoso?.scrollToIndex({ - align: 'end', - behavior: 'auto', - index: 'LAST', - }); - break; - } - case 'click': { - virtuoso?.scrollToIndex({ - align: 'end', - behavior: 'smooth', - index: 'LAST', - }); - break; - } - } + {!_.isEmpty(messages) && ( + <div + style={{ + position: 'absolute', + right: '50%', + transform: 'translateX(+50%)', + bottom: token.marginSM, + opacity: atBottom ? 0 : 1, + transition: 'opacity 0.2s', + transitionDelay: atBottom ? '0s' : '0.2s', }} - lastMessageContent={_.get(_.last(messages), 'content')} - /> - </div> + > + <ScrollBottomHandlerButton + atBottom={atBottom} + autoScroll={isStreaming} + onScrollToBottom={(type) => { + const virtuoso = virtuosoRef.current; + if (!isStreaming) { + switch (type) { + case 'auto': { + virtuoso?.scrollToIndex({ + align: 'end', + behavior: 'auto', + index: 'LAST', + }); + break; + } + case 'click': { + virtuoso?.scrollToIndex({ + align: 'end', + behavior: 'smooth', + index: 'LAST', + }); + break; + } + } + } + }} + lastMessageContent={_.get(_.last(messages), 'content')} + /> + </div> + )} </Flex> ); };