From 77bd17515d173629bb0620308c507cf8d3bb8c14 Mon Sep 17 00:00:00 2001 From: 1600822305 <161661698+1600822305@users.noreply.github.com> Date: Thu, 10 Apr 2025 17:47:23 +0800 Subject: [PATCH] Update ASRService.ts --- src/renderer/src/services/ASRService.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/renderer/src/services/ASRService.ts b/src/renderer/src/services/ASRService.ts index 252ecd9b1d..bfa2971ce9 100644 --- a/src/renderer/src/services/ASRService.ts +++ b/src/renderer/src/services/ASRService.ts @@ -119,19 +119,19 @@ class ASRService { console.log('[ASRService] 浏览器断开连接') this.browserReady = false window.message.error({ content: '语音识别浏览器断开连接', key: 'browser-status' }) - } - } else if (data.type === 'status' && data.message === 'stopped') { - // 语音识别已停止 - console.log('[ASRService] 语音识别已停止') - this.isRecording = false + } else if (data.message === 'stopped') { + // 语音识别已停止 + console.log('[ASRService] 语音识别已停止') + this.isRecording = false - // 如果没有收到最终结果,显示处理完成消息 - window.message.success({ content: i18n.t('settings.asr.completed'), key: 'asr-processing' }) + // 如果没有收到最终结果,显示处理完成消息 + window.message.success({ content: i18n.t('settings.asr.completed'), key: 'asr-processing' }) - // 如果有回调函数,调用一次空字符串,触发按钮状态重置 - if (this.resultCallback && typeof this.resultCallback === 'function') { - // 使用空字符串调用回调,不会影响输入框,但可以触发按钮状态重置 - this.resultCallback('') + // 如果有回调函数,调用一次空字符串,触发按钮状态重置 + if (this.resultCallback && typeof this.resultCallback === 'function') { + // 使用空字符串调用回调,不会影响输入框,但可以触发按钮状态重置 + this.resultCallback('') + } } } else if (data.type === 'result' && data.data) { // 处理识别结果