diff --git a/src/renderer/src/windows/mini/home/components/InputBar.tsx b/src/renderer/src/windows/mini/home/components/InputBar.tsx index cfd7d29457..0a378b6343 100644 --- a/src/renderer/src/windows/mini/home/components/InputBar.tsx +++ b/src/renderer/src/windows/mini/home/components/InputBar.tsx @@ -3,7 +3,7 @@ import { useTimer } from '@renderer/hooks/useTimer' import { Assistant } from '@renderer/types' import { Input as AntdInput } from 'antd' import { InputRef } from 'rc-input/lib/interface' -import React, { useRef } from 'react' +import React, { useEffect, useRef } from 'react' import styled from 'styled-components' interface InputBarProps { @@ -27,9 +27,13 @@ const InputBar = ({ }: InputBarProps & { ref?: React.RefObject }) => { const inputRef = useRef(null) const { setTimeoutTimer } = useTimer() - if (!loading) { - setTimeoutTimer('focus', () => inputRef.current?.input?.focus(), 0) - } + + useEffect(() => { + if (!loading) { + setTimeoutTimer('focus', () => inputRef.current?.input?.focus(), 0) + } + }) + return ( {assistant.model && }