Skip to content

Commit

Permalink
Update global config on local user STT language change
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 22, 2023
1 parent b175726 commit dd29017
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 @@ -295,10 +295,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 dd29017

Please sign in to comment.