Skip to content

Commit

Permalink
Merge pull request #149 from Daethyra/patch/handle_no_keys
Browse files Browse the repository at this point in the history
fix(pages): stop process if no API key is provided
  • Loading branch information
Daethyra committed Jun 20, 2024
2 parents 736746b + 26b9ddd commit 15af044
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions freestream/pages/1_💬_Curie.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
else:
anthropic_api_key = st.sidebar.text_input("Anthropic API Key", type="password")

# Stop the process if no API key is provided
if not openai_api_key and not anthropic_api_key:
st.error("You must provide at least one API key, either for OpenAI or Anthropic, to continue.", icon="🚨")
st.stop()

# Add temperature header
temperature_header = st.sidebar.markdown(
"""
Expand Down
4 changes: 4 additions & 0 deletions freestream/pages/2_🤖_RAGbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
else:
anthropic_api_key = st.sidebar.text_input("Anthropic API Key", type="password")

# Stop the process if no API key is provided
if not openai_api_key and not anthropic_api_key:
st.error("You must provide at least one API key, either for OpenAI or Anthropic, to continue.", icon="🚨")
st.stop()

# Add file-upload button
uploaded_files = st.sidebar.file_uploader(
Expand Down

0 comments on commit 15af044

Please sign in to comment.