Skip to content

Commit

Permalink
Fix STT language handling
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 7, 2023
1 parent 39e8fa8 commit e1f7e3e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions neon_iris/web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ def __init__(self, lang: str = None):
self._audio_path = join(xdg_data_home(), "iris", "stt")
if not isdir(self._audio_path):
makedirs(self._audio_path)
self.lang = lang or self.config.get('default_lang') or \
self.config.get('languages', ['en-us'])[0]
self.default_lang = lang or self.config.get('default_lang')
self.chat_ui = gradio.Blocks()

@property
def lang(self):
return self.user_config['speech']['stt_language'] or self.default_lang

@property
def supported_languages(self) -> List[str]:
"""
Get a list of supported languages from configuration
@returns: list of BCP-47 language codes
"""
return self.config.get('languages') or [self.lang]
return self.config.get('languages') or [self.default_lang]

def update_profile(self, stt_lang: str, tts_lang: str, tts_lang_2: str):
"""
Expand Down Expand Up @@ -130,7 +133,7 @@ def on_user_input(self, utterance: str, *args, **kwargs) -> str:
self._await_response.clear()
self._response = None
if utterance:
LOG.info(f"Sending utterance: {utterance}")
LOG.info(f"Sending utterance: {utterance} with lang: {self.lang}")
self.send_utterance(utterance, self.lang)
else:
LOG.info(f"Sending audio: {args[1]} with lang: {self.lang}")
Expand Down

0 comments on commit e1f7e3e

Please sign in to comment.