Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: scroll down when reach bottom. add word break for li. #124

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/common/chatUi/chatUi.less
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@
margin: 0;
word-break: break-word;
}
li {
word-break: break-word;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion components/common/chatUi/chatUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const ConversationMessage = forwardRef<
if (onlyWhenReachBottom && outerRef.current) {
// 22 = 1em + line height
const ifReachBottom =
outerRef.current?.scrollTop >= outerRef.current?.scrollHeight - outerRef.current?.clientHeight - 22;
outerRef.current?.scrollTop >= outerRef.current?.scrollHeight - outerRef.current?.clientHeight - 100;
if (ifReachBottom) {
outerRef.current?.scrollTo(0, outerRef.current?.scrollHeight);
}
Expand Down Expand Up @@ -681,6 +681,7 @@ export const ChatBox: FC<ChatBoxProps> = (props) => {
robotAnswer.content += parsed?.choices?.[0]?.delta?.content;

await pushNewMsgToChat(newChat, robotAnswer, curChat);
messageRef.current?.scrollToBottom(true);
} catch (e) {
console.warn('Reach this code', invalidJson);
// to reach this code, it means the response is not valid or the code have something wrong.
Expand Down
Loading