唤醒流程更新,修复重复唤醒的问题
This commit is contained in:
@@ -89,7 +89,7 @@ class AIChatAssistantManager {
|
||||
|
||||
Future<void> startVoskWakeword() async {
|
||||
FlutterVoskWakeword.instance.initialize(
|
||||
wakeWords: ['你好众众', '你好', '众众'], // 唤醒词列表
|
||||
wakeWords: ['你好众众', '你好', '众众', '测试', '哈喽', '唤醒'], // 唤醒词列表
|
||||
);
|
||||
|
||||
debugPrint('Starting Vosk Wakeword detection...');
|
||||
@@ -99,12 +99,10 @@ class AIChatAssistantManager {
|
||||
debugPrint('Vosk Wakeword detected: ${event.text}');
|
||||
_wakeWordDetected = true;
|
||||
// 通知所有监听者
|
||||
// _wakeWordController.add(null);
|
||||
|
||||
// 可选:一段时间后自动重置状态
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
_wakeWordDetected = false;
|
||||
});
|
||||
_wakeWordController.add(null);
|
||||
// 监听到之后就停止,这个时候已经弹出了对话框
|
||||
// 对话框消失就可以继续监听 recognitionStream 的订阅不会断开
|
||||
FlutterVoskWakeword.instance.stop();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user