Desmond-Dong commited on
Commit
a9c7d5d
·
1 Parent(s): 9aa7e2d

fix: 修复stop词检测,设置stop_word的id属性

Browse files
reachy_mini_ha_voice/voice_assistant.py CHANGED
@@ -551,7 +551,9 @@ class VoiceAssistantService:
551
  stop_config = _WAKEWORDS_DIR / "stop.json"
552
  if stop_config.exists():
553
  try:
554
- return MicroWakeWord.from_config(stop_config)
 
 
555
  except Exception as e:
556
  _LOGGER.warning("Failed to load stop model: %s", e)
557
 
@@ -559,7 +561,9 @@ class VoiceAssistantService:
559
  _LOGGER.warning("Stop model not available, using fallback")
560
  okay_nabu_config = _WAKEWORDS_DIR / "okay_nabu.json"
561
  if okay_nabu_config.exists():
562
- return MicroWakeWord.from_config(okay_nabu_config)
 
 
563
 
564
  return None
565
 
 
551
  stop_config = _WAKEWORDS_DIR / "stop.json"
552
  if stop_config.exists():
553
  try:
554
+ model = MicroWakeWord.from_config(stop_config)
555
+ setattr(model, 'id', 'stop')
556
+ return model
557
  except Exception as e:
558
  _LOGGER.warning("Failed to load stop model: %s", e)
559
 
 
561
  _LOGGER.warning("Stop model not available, using fallback")
562
  okay_nabu_config = _WAKEWORDS_DIR / "okay_nabu.json"
563
  if okay_nabu_config.exists():
564
+ model = MicroWakeWord.from_config(okay_nabu_config)
565
+ setattr(model, 'id', 'stop')
566
+ return model
567
 
568
  return None
569