From 0e93afe1d55e5f51895ad5f66eb7b6ab7b396109 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:27:56 -0800 Subject: [PATCH] Handle user profile updates from Neon (#36) Handle MQ connection errors with useful log in CLI Update default config for Docker Co-authored-by: Daniel McKnight --- docker_overlay/etc/neon/neon.yaml | 26 +++++++++++++++++++++++++- neon_iris/cli.py | 8 ++++++-- neon_iris/web_client.py | 9 +++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/docker_overlay/etc/neon/neon.yaml b/docker_overlay/etc/neon/neon.yaml index bf3a9b3..dea30dc 100644 --- a/docker_overlay/etc/neon/neon.yaml +++ b/docker_overlay/etc/neon/neon.yaml @@ -16,4 +16,28 @@ iris: - en-us - fr-fr - es-es - - uk-ua \ No newline at end of file + - de-de + - it-it + - uk-ua + - nl-nl + - pt-pt + - 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 diff --git a/neon_iris/cli.py b/neon_iris/cli.py index e7e6cef..90be32f 100644 --- a/neon_iris/cli.py +++ b/neon_iris/cli.py @@ -132,8 +132,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 OSError: + click.echo("Unable to connect to MQ server") @neon_iris_cli.command(help="Transcribe an audio file") diff --git a/neon_iris/web_client.py b/neon_iris/web_client.py index b9a0db2..011d21e 100644 --- a/neon_iris/web_client.py +++ b/neon_iris/web_client.py @@ -316,6 +316,15 @@ def handle_api_response(self, message: Message): """ LOG.debug(f"Got {message.msg_type}: {message.data}") + def _handle_profile_update(self, message: Message): + updated_profile = message.data["profile"] + session_id = updated_profile['user']['username'] + if session_id in self._profiles: + LOG.info(f"Got profile update for {session_id}") + self._profiles[session_id] = updated_profile + else: + LOG.warning(f"Ignoring profile update for {session_id}") + def handle_error_response(self, message: Message): """ Handle an error response from the MQ service attached to Neon. This