Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

enh:setfocus after voice input (#7317)

呆萌闷油瓶fcb6921b5759
diff --git a/web/app/components/base/chat/chat/chat-input.tsx b/web/app/components/base/chat/chat/chat-input.tsx
index 6d15010f856..fcf9b2c23fa 100644
--- a/web/app/components/base/chat/chat/chat-input.tsx
+++ b/web/app/components/base/chat/chat/chat-input.tsx
@@ -49,6 +49,7 @@ const ChatInput: FC<ChatInputProps> = ({
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const [voiceInputShow, setVoiceInputShow] = useState(false)
+ const textAreaRef = useRef<HTMLTextAreaElement>(null)
const {
files,
onUpload,
@@ -176,6 +177,7 @@ const ChatInput: FC<ChatInputProps> = ({
)
}
<Textarea
+ ref={textAreaRef}
className={`
block w-full px-2 pr-[118px] py-[7px] leading-5 max-h-none text-sm text-gray-700 outline-none appearance-none resize-none
${visionConfig?.enabled && 'pl-12'}
@@ -234,7 +236,10 @@ const ChatInput: FC<ChatInputProps> = ({
voiceInputShow && (
<VoiceInput
onCancel={() => setVoiceInputShow(false)}
- onConverted={text => setQuery(text)}
+ onConverted={(text) => {
+ setQuery(text)
+ textAreaRef.current?.focus()
+ }}
/>
)
}