From e889581a0f718159df2df20d478e17e68e98488c Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Mon, 13 Nov 2023 15:52:06 -0800 Subject: [PATCH] Refactor `mq_from_client` to `client_to_core` to be more precise --- neon_speech/service.py | 4 ++-- tests/api_method_tests.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index beadbec..91eca03 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -351,7 +351,7 @@ def handle_get_stt(self, message: Message): sent_time = message.context.get("timing", {}).get("client_sent", received_time) if received_time != sent_time: - message.context['timing']['mq_from_client'] = \ + message.context['timing']['client_to_core'] = \ received_time - sent_time self.bus.emit(message.reply(ident, data={"parser_data": parser_data, @@ -386,7 +386,7 @@ def build_context(msg: Message): sent_time = message.context.get("timing", {}).get("client_sent", received_time) if received_time != sent_time: - message.context['timing']['mq_from_client'] = \ + message.context['timing']['client_to_core'] = \ received_time - sent_time ident = message.context.get("ident") or "neon.audio_input.response" LOG.info(f"Handling audio input: {ident}") diff --git a/tests/api_method_tests.py b/tests/api_method_tests.py index 7bd6e5f..8db03b6 100644 --- a/tests/api_method_tests.py +++ b/tests/api_method_tests.py @@ -149,7 +149,7 @@ def test_get_stt_valid_file(self): self.assertIn("stop", stt_resp.data.get("transcripts")) self.assertEqual(stt_resp.context['timing']['client_sent'], context['timing']['client_sent'], stt_resp.context) - self.assertIsInstance(stt_resp.context['timing']['mq_from_client'], + self.assertIsInstance(stt_resp.context['timing']['client_to_core'], float, stt_resp.context) def test_get_stt_valid_contents(self): @@ -187,7 +187,7 @@ def test_audio_input_valid(self): self.assertEqual(context[key], stt_resp.context[key]) self.assertIsInstance(stt_resp.data.get("skills_recv"), bool, stt_resp.serialize()) - self.assertIsInstance(stt_resp.context['timing']['mq_from_client'], + self.assertIsInstance(stt_resp.context['timing']['client_to_core'], float, stt_resp.context) handle_utterance.assert_called_once() @@ -201,7 +201,7 @@ def test_audio_input_valid(self): self.assertIn("stop", message.data["utterances"], message.data.get("utterances")) self.assertIsInstance(message.context["timing"], dict) - self.assertIsInstance(message.context['timing']['mq_from_client'], + self.assertIsInstance(message.context['timing']['client_to_core'], float, message.context) self.assertIsInstance(message.context['timing']['transcribed'], float, message.context)