File tree Expand file tree Collapse file tree 6 files changed +22
-11
lines changed Expand file tree Collapse file tree 6 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ NoteGen is a cross-platform `Markdown` note-taking application dedicated to usin
24
24
25
25
Recording:
26
26
27
- ![ record] ( https://s2.loli.net/2025/04/14/NxhiWjMZT7RtusS.png )
27
+ ![ record] ( https://github.com/user-attachments/assets/34f7fdc7-ebab-473f-ad8b-e2e93ed0f9e3 )
28
28
29
29
Writing:
30
30
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ NoteGen is a cross-platform `Markdown` note-taking application dedicated to usin
13
13
14
14
Recording:
15
15
16
- ![ record] ( https://s2.loli.net/2025/04/14/NxhiWjMZT7RtusS.png )
16
+ ![ record] ( https://github.com/user-attachments/assets/34f7fdc7-ebab-473f-ad8b-e2e93ed0f9e3 )
17
17
18
18
Writing:
19
19
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ NoteGenは、AIを使用して記録と執筆を橋渡しし、断片化され
13
13
14
14
記録:
15
15
16
- ![ record] ( https://s2.loli.net/2025/04/14/NxhiWjMZT7RtusS.png )
16
+ ![ record] ( https://github.com/user-attachments/assets/34f7fdc7-ebab-473f-ad8b-e2e93ed0f9e3 )
17
17
18
18
執筆:
19
19
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ NoteGen 是一款的跨端的 `Markdown` 笔记应用,致力于使用 AI 建
15
15
16
16
记录:
17
17
18
- ![ record] ( https://s2.loli.net/2025/04/14/NxhiWjMZT7RtusS.png )
18
+ ![ record] ( https://github.com/user-attachments/assets/34f7fdc7-ebab-473f-ad8b-e2e93ed0f9e3 )
19
19
20
20
写作:
21
21
Original file line number Diff line number Diff line change @@ -15,23 +15,31 @@ import useSyncStore from '@/stores/sync'
15
15
import { Avatar , AvatarImage } from '@/components/ui/avatar'
16
16
import ChatThinking from './chat-thinking'
17
17
import { Separator } from '@/components/ui/separator'
18
+ import { debounce } from 'lodash-es'
18
19
19
20
export default function ChatContent ( ) {
20
21
const { chats, init } = useChatStore ( )
21
22
const { currentTagId } = useTagStore ( )
22
23
23
- useEffect ( ( ) => {
24
- init ( currentTagId )
25
- } , [ currentTagId ] )
26
-
27
- useEffect ( ( ) => {
24
+ function scrollToBottom ( ) {
28
25
const md = document . querySelector ( '#chats-wrapper' )
29
26
if ( md ) {
30
27
md . scroll ( 0 , md . scrollHeight )
31
28
setTimeout ( ( ) => {
32
29
md . scroll ( 0 , md . scrollHeight )
33
- } , 500 )
30
+ } , 1000 )
34
31
}
32
+ }
33
+
34
+ // debounce
35
+ const scrollToBottomDebounce = debounce ( scrollToBottom , 500 )
36
+
37
+ useEffect ( ( ) => {
38
+ init ( currentTagId )
39
+ } , [ currentTagId ] )
40
+
41
+ useEffect ( ( ) => {
42
+ scrollToBottomDebounce ( )
35
43
} , [ chats ] )
36
44
37
45
return < div id = "chats-wrapper" className = "flex-1 overflow-y-auto overflow-x-hidden w-full flex flex-col items-end p-4 gap-6" >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import useSettingStore from "@/stores/setting";
3
3
import { useEffect , useRef , useState } from 'react' ;
4
4
import { useTheme } from 'next-themes'
5
5
import useChatStore from '@/stores/chat' ;
6
+ import { debounce } from 'lodash-es'
6
7
7
8
export default function ChatPreview ( { text} : { text : string } ) {
8
9
const [ id ] = useState ( 'preview-only' ) ;
@@ -26,8 +27,10 @@ export default function ChatPreview({text}: {text: string}) {
26
27
} , 100 ) ;
27
28
}
28
29
30
+ const bindPreviewLinkDebounce = debounce ( bindPreviewLink , 1000 )
31
+
29
32
useEffect ( ( ) => {
30
- bindPreviewLink ( )
33
+ bindPreviewLinkDebounce ( )
31
34
} , [ chats ] )
32
35
33
36
useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments