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连接未就绪')