From f135bcb60c8864bf0a33baaf26848e08b6cee4a2 Mon Sep 17 00:00:00 2001 From: 1600822305 <1600822305@qq.com> Date: Fri, 11 Apr 2025 03:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/services/ASRService.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/services/ASRService.ts b/src/renderer/src/services/ASRService.ts index 156fbac7ca..71b0542469 100644 --- a/src/renderer/src/services/ASRService.ts +++ b/src/renderer/src/services/ASRService.ts @@ -138,7 +138,10 @@ class ASRService { // 如果有回调函数,调用一次空字符串,触发按钮状态重置 if (this.resultCallback && typeof this.resultCallback === 'function') { // 使用空字符串调用回调,不会影响输入框,但可以触发按钮状态重置 - setTimeout(() => this.resultCallback(''), 100) + const callback = this.resultCallback as (text: string, isFinal?: boolean) => void; // 明确指定类型 + setTimeout(() => { + callback('', false); + }, 100) } } } else if (data.type === 'result' && data.data) { @@ -330,7 +333,9 @@ class ASRService { if (onTranscribed) { // 使用空字符串调用回调,不会影响输入框,但可以触发按钮状态重置 // 传递false表示这不是最终结果,只是状态更新 - setTimeout(() => onTranscribed('', false), 100) + setTimeout(() => { + onTranscribed('', false); + }, 100) } } else { throw new Error('WebSocket连接未就绪')