From 7e70dc898f747c4a426e18cbcae626c89b29f198 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 10:41:18 -0700 Subject: [PATCH 01/10] Disable message source validation to ensure backwards-compat. --- neon_speech/service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 44ce694..935d4fb 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -109,7 +109,9 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, on_alive=alive_hook, on_started=started_hook, bus=bus, - watchdog=watchdog) + watchdog=watchdog, + validate_source=False) + # TODO: Temporarily disable validate_source to ensure backwards-compat self.daemon = daemonic self.config.bus = self.bus from neon_utils.signal_utils import init_signal_handlers, \ From b41833e60f0e233398460d05497d51b50297b4ea Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 11:01:59 -0700 Subject: [PATCH 02/10] Add back source validation with context patch with deprecation notice --- neon_speech/service.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 935d4fb..050f8b1 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -35,7 +35,7 @@ from pydub import AudioSegment from speech_recognition import AudioData from neon_utils.file_utils import decode_base64_string_to_file -from ovos_utils.log import LOG +from ovos_utils.log import LOG, log_deprecation from neon_utils.configuration_utils import get_neon_user_config from neon_utils.metrics_utils import Stopwatch from neon_utils.user_utils import apply_local_user_profile_updates @@ -135,6 +135,14 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, LOG.info("Skipping api_stt init") self.api_stt = None + def _validate_message_context(self, message: Message, native_sources=None): + if "audio" not in message.context['destination']: + log_deprecation(f"Adding audio to destination context for " + f"{message.msg_type}", "5.0.0") + message.context['destination'].append('audio') + OVOSDinkumVoiceService._validate_message_context(self, message, + native_sources) + def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): OVOSDinkumVoiceService.run(self) From c65cb80dce068bb094a966ee37ee5bb24dc86404 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 11:19:40 -0700 Subject: [PATCH 03/10] Troubleshoot listen button --- neon_speech/service.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 050f8b1..3cf479a 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -140,8 +140,12 @@ def _validate_message_context(self, message: Message, native_sources=None): log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') - OVOSDinkumVoiceService._validate_message_context(self, message, - native_sources) + if not OVOSDinkumVoiceService._validate_message_context(self, message, + native_sources): + # TODO: Temporary backwards-compat. + LOG.warning(f"Context not validated for: {message.msg_type}|" + f"sources={native_sources}|context={message.context}") + return True def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): From 0d1a420e31410f6408d282d04ff61b10030ee0de Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 11:35:16 -0700 Subject: [PATCH 04/10] Troubleshoot listen button --- neon_speech/service.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 3cf479a..0474810 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -109,9 +109,7 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, on_alive=alive_hook, on_started=started_hook, bus=bus, - watchdog=watchdog, - validate_source=False) - # TODO: Temporarily disable validate_source to ensure backwards-compat + watchdog=watchdog) self.daemon = daemonic self.config.bus = self.bus from neon_utils.signal_utils import init_signal_handlers, \ @@ -140,12 +138,6 @@ def _validate_message_context(self, message: Message, native_sources=None): log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') - if not OVOSDinkumVoiceService._validate_message_context(self, message, - native_sources): - # TODO: Temporary backwards-compat. - LOG.warning(f"Context not validated for: {message.msg_type}|" - f"sources={native_sources}|context={message.context}") - return True def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): From ff850c49aacb09173eaf0300669d87e53d3203a1 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 11:40:25 -0700 Subject: [PATCH 05/10] Fix missing return in `_validate_message_context` --- neon_speech/service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neon_speech/service.py b/neon_speech/service.py index 0474810..7229009 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -138,6 +138,8 @@ def _validate_message_context(self, message: Message, native_sources=None): log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') + return OVOSDinkumVoiceService._validate_message_context(self, message, + native_sources) def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): From 7bc9f90565672d76b10bf332f4d9ba11f3680703 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 11:49:46 -0700 Subject: [PATCH 06/10] Add debug logging --- neon_speech/service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/neon_speech/service.py b/neon_speech/service.py index 7229009..832b6e0 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -138,6 +138,7 @@ def _validate_message_context(self, message: Message, native_sources=None): log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') + LOG.debug(f"Checking sources {native_sources} for {message.context}") return OVOSDinkumVoiceService._validate_message_context(self, message, native_sources) From 70e10ff75f8ce2dedd76da80240b4fbd89101f78 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 12:18:05 -0700 Subject: [PATCH 07/10] More context validation debugging --- neon_speech/service.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neon_speech/service.py b/neon_speech/service.py index 832b6e0..ceb3948 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -142,6 +142,10 @@ def _validate_message_context(self, message: Message, native_sources=None): return OVOSDinkumVoiceService._validate_message_context(self, message, native_sources) + def _handle_listen(self, message: Message): + LOG.debug(f"handle listen context={message.context}") + OVOSDinkumVoiceService._handle_listen(self, message) + def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): OVOSDinkumVoiceService.run(self) From 6a2ae88ce43ba41a6c9a31cfe3bcffccd1e8b7eb Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 12:19:33 -0700 Subject: [PATCH 08/10] Fix potential bug in context validation --- neon_speech/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index ceb3948..f4cd8b8 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -134,7 +134,8 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, self.api_stt = None def _validate_message_context(self, message: Message, native_sources=None): - if "audio" not in message.context['destination']: + if message.context.get('destination') and \ + "audio" not in message.context['destination']: log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') From e8bdd3b0632aa9f75f2a78672d337bbd3563b4c0 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 12:28:04 -0700 Subject: [PATCH 09/10] Cleanup temporary destination validation override --- neon_speech/service.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index f4cd8b8..769842b 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -139,14 +139,9 @@ def _validate_message_context(self, message: Message, native_sources=None): log_deprecation(f"Adding audio to destination context for " f"{message.msg_type}", "5.0.0") message.context['destination'].append('audio') - LOG.debug(f"Checking sources {native_sources} for {message.context}") return OVOSDinkumVoiceService._validate_message_context(self, message, native_sources) - def _handle_listen(self, message: Message): - LOG.debug(f"handle listen context={message.context}") - OVOSDinkumVoiceService._handle_listen(self, message) - def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): OVOSDinkumVoiceService.run(self) From 8fd983f9ea9a62e0ff0c578dd493be75b4c262a5 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 26 Oct 2023 12:54:50 -0700 Subject: [PATCH 10/10] Pin ovos-dinkum-listener for stable release --- requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 44c5c1c..c9f6b97 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos-dinkum-listener~=0.0.2,>=0.0.3a16 +ovos-dinkum-listener==0.0.3a16 ovos-bus-client~=0.0.3 ovos-utils~=0.0.30 ovos-plugin-manager~=0.0.23