From 01ac693375c9235a79cb46c31b0f7ecb7afbe839 Mon Sep 17 00:00:00 2001 From: Madie Laine <106930581+AdieLaine@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:00:53 +0000 Subject: [PATCH] modified: streamly.py --- streamly.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/streamly.py b/streamly.py index b789bc4..8b8db29 100644 --- a/streamly.py +++ b/streamly.py @@ -10,7 +10,7 @@ import base64 -from openai import OpenAI +from openai import OpenAI, OpenAIError client = OpenAI() logging.basicConfig(level=logging.INFO) @@ -217,7 +217,7 @@ def on_chat_submit(chat_input, api_key, latest_updates, use_langchain=False): st.session_state.history.append({"role": "user", "content": user_input}) st.session_state.history.append({"role": "assistant", "content": assistant_reply}) - except openai.APIConnectionError as e: + except OpenAIError.APIConnectionError as e: logging.error(f"Error occurred: {e}") error_message = f"OpenAI Error: {str(e)}" st.error(error_message)