From aeff73d680cca556fda3f92dfbb91e41046582cd Mon Sep 17 00:00:00 2001 From: Madie Laine <106930581+AdieLaine@users.noreply.github.com> Date: Wed, 24 Jul 2024 16:37:32 -0400 Subject: [PATCH] Update streamly.py --- streamly.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/streamly.py b/streamly.py index 0cdfab6..62b1078 100644 --- a/streamly.py +++ b/streamly.py @@ -212,6 +212,12 @@ 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 OpenAIError.APIConnectionError as e: + logging.error(f"Error occurred: {e}") + error_message = f"OpenAI Error: {str(e)}" + st.error(error_message) + #st.session_state.history.append({"role": "assistant", "content": error_message}) + def main(): """ Display Streamlit updates and handle the chat interface.