Skip to content

Commit

Permalink
Update global config on local user STT language change (#184)
Browse files Browse the repository at this point in the history
# Description
Handle local user language changes as global changes for STT handling

# Issues
<!-- If this is related to or closes an issue/other PR, please note them
here -->

# Other Notes
<!-- Note any breaking changes, WIP changes, requests for input, etc.
here -->

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Nov 22, 2023
1 parent 11c9f11 commit 4c2f2e7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions neon_speech/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,18 @@ def handle_profile_update(self, message):
:param message: Message associated with profile update
"""
updated_profile = message.data.get("profile")
if updated_profile["user"]["username"] == \
if updated_profile["user"]["username"] != \
self._default_user["user"]["username"]:
apply_local_user_profile_updates(updated_profile,
self._default_user)
LOG.info(f"Ignoring profile update for "
f"{updated_profile['user']['username']}")
return
apply_local_user_profile_updates(updated_profile,
self._default_user)
if updated_profile.get("speech", {}).get("stt_language"):
new_stt_lang = updated_profile["speech"]["stt_language"]
if new_stt_lang != self.config['lang']:
from neon_speech.utils import patch_config
patch_config({"lang": new_stt_lang})

def handle_wake_words_state(self, message):
"""
Expand Down

0 comments on commit 4c2f2e7

Please sign in to comment.