fix: 不支持语音识别时修改isRecording状态
This commit is contained in:
@@ -196,7 +196,9 @@ const startRecording = () => {
|
||||
if (!speechRecognition) {
|
||||
// 检查浏览器支持
|
||||
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) {
|
||||
alert('您的浏览器不支持语音识别功能')
|
||||
// alert('您的浏览器不支持语音识别功能')
|
||||
showToast('Your browser does not support speech recognition, please try again with another browser')
|
||||
isRecording.value = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -244,7 +246,7 @@ const startRecording = () => {
|
||||
|
||||
// 显示临时结果(可选)
|
||||
if (interimTranscript) {
|
||||
console.log('临时识别结果:', interimTranscript)
|
||||
console.log('语音转文字识别中:', interimTranscript)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +263,7 @@ const startRecording = () => {
|
||||
console.error('语音识别错误:', event.error)
|
||||
isRecording.value = false
|
||||
// alert('语音识别失败,请重试')
|
||||
showToast('Speech recognition failed, please try again')
|
||||
showToast(event.error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user