Skip to content

Commit

Permalink
Disable yet-to-be-implemented language API by default
Browse files Browse the repository at this point in the history
Catch MQ connection error exceptions in CLI entrypoint
Override default location in Docker system config
  • Loading branch information
NeonDaniel committed Nov 21, 2023
1 parent f2b65d2 commit 53710c0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 16 deletions.
21 changes: 20 additions & 1 deletion docker_overlay/etc/neon/neon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,23 @@ iris:
- uk-ua
- nl-nl
- pt-pt
- ca-es
- ca-es

location:
city:
code: Renton
name: Renton
state:
code: WA
name: Washington
country:
code: US
name: United States
coordinate:
latitude: 47.482880
longitude: -122.217064
timezone:
code: America/Los_Angeles
name: Pacific Standard Time
dstOffset: 3600000
offset: -28800000
9 changes: 7 additions & 2 deletions neon_iris/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import logging
import socket
from pprint import pformat

import click
Expand Down Expand Up @@ -132,8 +133,12 @@ def start_listener():
@neon_iris_cli.command(help="Create a GradIO Client session")
def start_gradio():
from neon_iris.web_client import GradIOClient
chat = GradIOClient()
chat.run()
_print_config()
try:
chat = GradIOClient()
chat.run()
except socket.gaierror:
click.echo("Unable to connect to MQ server")


@neon_iris_cli.command(help="Transcribe an audio file")
Expand Down
29 changes: 16 additions & 13 deletions neon_iris/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,23 @@ def __init__(self, mq_config: dict = None, config_dir: str = None):
self.audio_cache_dir = join(xdg_cache_home(), "neon", "neon_iris")
makedirs(self.audio_cache_dir, exist_ok=True)

config = Configuration().get("iris", {})

# Collect supported languages
message = self._build_message("ovos.languages.stt", {})
self._send_message(message)
message = self._build_message("ovos.languages.tts", {})
self._send_message(message)
if self._language_init.wait(30):
LOG.info(f"Got language support: {self._languages}")
else:
self._languages['stt'] = self._config.get('iris',
{}).get('languages')
self._languages['tts'] = self._config.get('iris',
{}).get('languages')
LOG.warning(f"Timed out updating languages. Using configuration: "
f"{self._languages}")
if config.get("enable_lang_api"):
message = self._build_message("ovos.languages.stt", {})
self._send_message(message)
message = self._build_message("ovos.languages.tts", {})
self._send_message(message)

if self._language_init.wait(30):
LOG.info(f"Got language support: {self._languages}")

if not self._languages:
lang_config = config.get('languages') or []
self._languages['stt'] = lang_config
self._languages['tts'] = lang_config
LOG.debug(f"Using supported langs configuration: {self._languages}")

@property
def uid(self) -> str:
Expand Down

0 comments on commit 53710c0

Please sign in to comment.