Skip to content

Commit

Permalink
fix pydantic error 6
Browse files Browse the repository at this point in the history
  • Loading branch information
sborms committed Oct 22, 2023
1 parent 14cb289 commit 42f498a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions webapp/pages/05_📣_Coachbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ def lets_chat():
st.markdown("### Seek advice from an AI futsal coach")

# initialize session state
if "team" not in st.session_state and "lets_chat" not in st.session_state:
if "team" not in st.session_state:
st.session_state["team"] = "ZVC Copains"
if "lets_chat" not in st.session_state:
st.session_state["lets_chat"] = False
if "chain" not in st.session_state:
st.session_state["chain"] = None

# ask for team first
if not st.session_state["lets_chat"]:
Expand Down Expand Up @@ -165,6 +168,7 @@ def lets_chat():

# configure chain
chain = load_chain(input_openai_api_key=openai.api_key, context=context)
st.session_state["chain"] = chain

# initialize chat history
if "messages" not in st.session_state:
Expand Down Expand Up @@ -196,7 +200,7 @@ def lets_chat():
with st.chat_message("assistant", avatar=avatar_ai):
# send user's question to chain
try:
result = chain({"input": query})
result = st.session_state["chain"]({"input": query})
except AuthenticationError:
st.warning("Your API key is invalid or expired...")
st.stop()
Expand Down

0 comments on commit 42f498a

Please sign in to comment.