refactor: simplify new topic shortcut logic in Inputbar

- Removed loading check in the new topic shortcut to streamline the process of adding a new topic and focusing the textarea.
This commit is contained in:
ousugo 2025-03-19 15:56:38 +08:00 committed by 亢奋猫
parent cbb1173a3d
commit c527fbdcd2

View File

@ -518,11 +518,9 @@ const Inputbar: FC<Props> = ({ assistant: _assistant, setActiveTopic, topic }) =
}, [isDragging, handleDrag, handleDragEnd]) }, [isDragging, handleDrag, handleDragEnd])
useShortcut('new_topic', () => { useShortcut('new_topic', () => {
if (!loading) { addNewTopic()
addNewTopic() EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR)
EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR) textareaRef.current?.focus()
textareaRef.current?.focus()
}
}) })
useShortcut('clear_topic', () => { useShortcut('clear_topic', () => {