File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export default function Page({
24
24
const [ text , setText ] = useState ( "" ) ;
25
25
const [ response , setResponse ] = useState ( "" ) ;
26
26
const [ page , setPage ] = useState ( "main" ) ;
27
- const [ maxTokens , setMaxTokens ] = useState ( 100 ) ;
27
+ const [ maxTokens , setMaxTokens ] = useState ( 400 ) ;
28
28
const [ systemPrompt , setSystemPrompt ] = useState ( loadedSystemPrompt ) ;
29
29
const [ promptList , setPromptList ] = useState ( loadedPromptList ) ;
30
30
const [ prompt , setPrompt ] = useState ( loadedPromptList && loadedPromptList [ 0 ] ) ;
Original file line number Diff line number Diff line change 1
- import React , { useEffect } from "react" ;
1
+ import React , { useEffect , useRef } from "react" ;
2
2
import TextArea from "./Textarea" ;
3
3
const MainPage = ( {
4
4
prompt,
@@ -11,6 +11,18 @@ const MainPage = ({
11
11
setText,
12
12
isGenerating,
13
13
} ) => {
14
+ const scrollRef = useRef ( null ) ;
15
+
16
+ const scrollToBottom = ( ) => {
17
+ if ( scrollRef . current ) {
18
+ scrollRef . current . scrollIntoView ( ) ;
19
+ }
20
+ } ;
21
+
22
+ useEffect ( ( ) => {
23
+ scrollToBottom ( ) ;
24
+ } , [ response , isGenerating ] ) ;
25
+
14
26
useEffect ( ( ) => {
15
27
const handleKeyPress = ( event ) => {
16
28
console . log ( event ) ;
@@ -98,6 +110,7 @@ const MainPage = ({
98
110
< div className = "border rounded-md p-3" > { response . outputText } </ div >
99
111
</ div >
100
112
) }
113
+ < div ref = { scrollRef } > </ div >
101
114
</ div >
102
115
</ form >
103
116
) ;
You can’t perform that action at this time.
0 commit comments