修复部分问题

This commit is contained in:
1600822305 2025-04-11 03:42:16 +08:00
parent a86b4ba404
commit a325ec091d

View File

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