synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
941 stars 101 forks source link

Missing catching/handling for remote rhaspy STT errors #209

Open litinoveweedle opened 4 years ago

litinoveweedle commented 4 years ago

When one Rhasspy (client) is using another Rhasspy (server) via HTTP API for STT conversion and no sentence is pronounced after wake word, so webrtcvad will record empty audio, then API error 400 is returned by Rhasspy server (which is probably OK), but it is also TTS by client Rhasspy back to user (which is probably not OK as it is just internal error):

Sorry, I had an error processing your command: Unexpected HTTP error 400

It would be nice to handle this and similar exception and for example play just error sounds, when anything else than HTTP 200 is returned by remote STT API. Rhasspy administrator could still see returned error codes in log, if troubleshooting is required.

[DEBUG:3507565] APlayAudioPlayer: ['aplay', '-q'] [DEBUG:3506756] FliteSentenceSpeaker: ready -> speaking [DEBUG:3506615] PorcupineWakeListener: started -> listening [DEBUG:3506613] DialogueManager: ready -> asleep [INFO:3506612] DialogueManager: Automatically listening for wake word [DEBUG:3506609] DialogueManager: handling -> ready [DEBUG:3506561] WebSocketObserver: {"text": "", "intent": {"name": "", "confidence": 0}, "entities": [], "raw_text": "", "speech_confidence": 1, "wakeId": "porcupine", "siteId": "default", "slots": {}} [WARNING:3506560] HomeAssistantIntentHandler: Empty intent. Not sending to Home Assistant [DEBUG:3506559] DialogueManager: recognizing -> handling [DEBUG:3506558] APlayAudioPlayer: ['aplay', '-q', '/usr/share/rhasspy/etc/wav/beep_error.wav'] [DEBUG:3506556] FliteSentenceSpeaker: ['flite', '-t', 'Sorry, I had an error processing your command: Unexpected HTTP error 400', '-o', '/dev/stdout', '-voice', 'kal16'] [DEBUG:3506554] DialogueManager: {'text': '', 'intent': {'name': '', 'confidence': 0}, 'entities': [], 'raw_text': '', 'speech_confidence': 1, 'wakeId': 'porcupine', 'siteId': 'default'} [DEBUG:3506550] HomeAssistantConversationRecognizer: Handling speech [DEBUG:3506530] urllib3.connectionpool: https://xxxxxxxxxxxxxx:8123 "POST /api/conversation/process HTTP/1.1" 200 114 [DEBUG:3505665] urllib3.connectionpool: Starting new HTTPS connection (1): xxxxxxxxxxxxxx:8123 [DEBUG:3505645] DialogueManager: decoding -> recognizing [DEBUG:3505643] DialogueManager: (confidence=1) [DEBUG:3505635] urllib3.connectionpool: http://xxxxxxxxxxxxxx:12101 "POST /api/speech-to-text?profile=en HTTP/1.1" 200 0 [DEBUG:3504864] urllib3.connectionpool: Starting new HTTP connection (1): xxxxxxxxxxxxxx:12101 [DEBUG:3504820] APlayAudioPlayer: ['aplay', '-q', '/usr/share/rhasspy/etc/wav/beep_lo.wav'] [DEBUG:3504819] RemoteDecoder: POSTing 43244 byte(s) of WAV data to http://xxxxxxxxxxxxxx:12101/api/speech-to-text [DEBUG:3504817] DialogueManager: awake -> decoding [DEBUG:3504815] WebrtcvadCommandListener: listening -> loaded [DEBUG:3504810] WebrtcvadCommandListener: Voice command finished [DEBUG:3503560] WebrtcvadCommandListener: Voice command started [DEBUG:3503025] PorcupineWakeListener: Loaded porcupine (keyword=[PosixPath('/profiles/en/porcupine/porcupine.ppn')]). Expecting sample rate=16000, frame length=512 [DEBUG:3502978] PorcupineWakeListener: listening -> started [DEBUG:3502977] APlayAudioPlayer: ['aplay', '-q', '/usr/share/rhasspy/etc/wav/beep_hi.wav'] [DEBUG:3502972] WebrtcvadCommandListener: loaded -> listening [DEBUG:3502971] WebrtcvadCommandListener: Will timeout in 30 second(s) [DEBUG:3502964] DialogueManager: asleep -> awake [DEBUG:3502962] DialogueManager: Awake! [DEBUG:3502960] PorcupineWakeListener: Hotword detected (0)