File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -479,6 +479,7 @@ export function useChatPrompt(ctx) {
479479const VoiceInput = {
480480 template : `
481481 <button v-if="$state.config.extensions.includes('voice')" type="button"
482+ ref="voiceBtn"
482483 @click="toggleRecording"
483484 :class="['absolute bottom-12 right-2 size-8 flex items-center justify-center rounded-full hover:shadow transition-colors',
484485 isRecording
@@ -502,6 +503,7 @@ const VoiceInput = {
502503 ` ,
503504 setup ( ) {
504505 const ctx = inject ( 'ctx' )
506+ const voiceBtn = ref ( null )
505507 const isRecording = ref ( false )
506508
507509 let mediaRecorder = null
@@ -561,6 +563,8 @@ const VoiceInput = {
561563 }
562564 mediaRecorder . start ( )
563565 isRecording . value = true
566+ // Focus the voice button to prevent textarea keyboard interference
567+ voiceBtn . value ?. focus ( )
564568 } catch ( err ) {
565569 ctx . setError ( { message : "Error accessing microphone: " + err . message } )
566570 isProcessing . value = false
@@ -585,6 +589,9 @@ const VoiceInput = {
585589
586590 if ( isProcessing . value ) return
587591
592+ // Already triggered by key, ignore until key is released
593+ if ( triggeredByKey . value ) return
594+
588595 if ( ! isRecording . value ) {
589596 // Start Recording (Press)
590597 triggeredByKey . value = true
@@ -628,6 +635,7 @@ const VoiceInput = {
628635 } )
629636
630637 return {
638+ voiceBtn,
631639 isProcessing,
632640 isRecording,
633641 toggleRecording,
You can’t perform that action at this time.
0 commit comments