apirrone commited on
Commit
6b4d81e
·
1 Parent(s): 0fbc69d

should get the key from the .env now

Browse files
src/reachy_mini_conversation_app/openai_realtime.py CHANGED
@@ -83,7 +83,8 @@ class OpenaiRealtimeHandler(AsyncStreamHandler):
83
  async def start_up(self) -> None:
84
  """Start the handler with minimal retries on unexpected websocket closure."""
85
  openai_api_key = config.OPENAI_API_KEY
86
- if self.gradio_mode:
 
87
  await self.wait_for_args() # type: ignore[no-untyped-call]
88
  args = list(self.latest_args)
89
  textbox_api_key = args[3] if len(args[3]) > 0 else None
 
83
  async def start_up(self) -> None:
84
  """Start the handler with minimal retries on unexpected websocket closure."""
85
  openai_api_key = config.OPENAI_API_KEY
86
+ if self.gradio_mode and not openai_api_key or not openai_api_key.strip():
87
+ # api key was not found in .env or in the environment variables
88
  await self.wait_for_args() # type: ignore[no-untyped-call]
89
  args = list(self.latest_args)
90
  textbox_api_key = args[3] if len(args[3]) > 0 else None