fix: can not create new topic on message generation

This commit is contained in:
kangfenmao 2024-07-14 11:39:23 +08:00
parent 31fa49095f
commit 03460b4ec8
2 changed files with 7 additions and 5 deletions

View File

@ -89,14 +89,16 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
// Command or Ctrl + N create new topic // Command or Ctrl + N create new topic
useEffect(() => { useEffect(() => {
const onKeydown = (e) => { const onKeydown = (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'n') { if (!generating) {
addNewTopic() if ((e.ctrlKey || e.metaKey) && e.key === 'n') {
inputRef.current?.focus() addNewTopic()
inputRef.current?.focus()
}
} }
} }
document.addEventListener('keydown', onKeydown) document.addEventListener('keydown', onKeydown)
return () => document.removeEventListener('keydown', onKeydown) return () => document.removeEventListener('keydown', onKeydown)
}, [addNewTopic]) }, [addNewTopic, generating])
useEffect(() => { useEffect(() => {
const unsubscribes = [ const unsubscribes = [

View File

@ -156,7 +156,7 @@ export async function checkApi(provider: Provider) {
key: 'api-check', key: 'api-check',
style: { marginTop: '3vh' }, style: { marginTop: '3vh' },
duration: valid ? 2 : 8, duration: valid ? 2 : 8,
content: valid ? t('api.connection.successful') : t('api.connection.failed') + ' ' + errorMessage content: valid ? t('message.api.connection.successful') : t('message.api.connection.failed') + ' ' + errorMessage
}) })
return valid return valid