mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-07 11:20:21 +08:00
feat: lockWhenAnswer config (#5)
This commit is contained in:
@@ -10,6 +10,7 @@ import FileSaver from 'file-saver'
|
||||
import { render } from 'preact'
|
||||
import FloatingToolbar from '../FloatingToolbar'
|
||||
import { useClampWindowSize } from '../../hooks/use-clamp-window-size'
|
||||
import { defaultConfig, getUserConfig } from '../../config'
|
||||
|
||||
const logo = Browser.runtime.getURL('logo.png')
|
||||
|
||||
@@ -63,6 +64,11 @@ function ConversationCard(props) {
|
||||
}
|
||||
})(),
|
||||
)
|
||||
const [config, setConfig] = useState(defaultConfig)
|
||||
|
||||
useEffect(() => {
|
||||
getUserConfig().then(setConfig)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (props.onUpdate) props.onUpdate()
|
||||
@@ -72,6 +78,10 @@ function ConversationCard(props) {
|
||||
bodyRef.current.scrollTop = bodyRef.current.scrollHeight
|
||||
}, [session])
|
||||
|
||||
useEffect(() => {
|
||||
if (config.lockWhenAnswer) bodyRef.current.scrollTop = bodyRef.current.scrollHeight
|
||||
}, [conversationItemData])
|
||||
|
||||
useEffect(() => {
|
||||
// when the page is responsive, session may accumulate redundant data and needs to be cleared after remounting and before making a new request
|
||||
if (props.question) {
|
||||
|
||||
Reference in New Issue
Block a user