bard [experimental]: upd err handler

This commit is contained in:
if 2023-04-03 22:16:38 +03:00
parent ec32424aae
commit 05a85cee1e

View File

@ -1,5 +1,6 @@
import streamlit as st
from openai.error import InvalidRequestError, OpenAIError
from requests.exceptions import TooManyRedirects
from streamlit_chat import message
from src.utils.agi.bard import Chatbot
@ -69,7 +70,7 @@ def bard_conversation() -> None:
bard = Chatbot(st.secrets.api_credentials.bard_session)
ai_content = bard.ask(st.session_state.user_text)
st.warning(ai_content.get("content"))
except AttributeError as err:
except (TooManyRedirects, AttributeError) as err:
st.error(err)