Skip to content

Commit

Permalink
Merge pull request #124 from subquery/feat/ai-chatlink
Browse files Browse the repository at this point in the history
feat: scroll down when reach bottom. add word break for li.
  • Loading branch information
HuberTRoy authored Nov 5, 2024
2 parents 18baee7 + edc0d86 commit efad655
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit efad655

Please sign in to comment.