UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

14 lines (10 loc) 405 B
import { TextAreaRef } from 'antd/es/input/TextArea'; import { RefObject, useEffect } from 'react'; import { useChatStore } from '@/store/chat'; import { chatSelectors } from '@/store/chat/selectors'; export const useAutoFocus = (inputRef: RefObject<TextAreaRef>) => { const chatKey = useChatStore(chatSelectors.currentChatKey); useEffect(() => { inputRef.current?.focus(); }, [chatKey]); };