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
useEffect(() => {
const onKeydown = (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'n') {
addNewTopic()
inputRef.current?.focus()
if (!generating) {
if ((e.ctrlKey || e.metaKey) && e.key === 'n') {
addNewTopic()
inputRef.current?.focus()
}
}
}
document.addEventListener('keydown', onKeydown)
return () => document.removeEventListener('keydown', onKeydown)
}, [addNewTopic])
}, [addNewTopic, generating])
useEffect(() => {
const unsubscribes = [

View File

@ -156,7 +156,7 @@ export async function checkApi(provider: Provider) {
key: 'api-check',
style: { marginTop: '3vh' },
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