vinhnx90 commited on
Commit
e4ab000
1 Parent(s): 83956ba

Handle secrets

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -71,7 +71,7 @@ def main():
71
  The main function that runs the Streamlit app.
72
  """
73
 
74
- if "OPENAI_API_KEY" in st.secrets:
75
  openai_api_key = st.secrets.OPENAI_API_KEY
76
  else:
77
  openai_api_key = st.sidebar.text_input("OpenAI API Key", type="password")
@@ -89,7 +89,7 @@ def main():
89
 
90
  if prompt := st.chat_input(
91
  placeholder="Chat with your document",
92
- disabled=(not st.secrets.OPENAI_API_KEY),
93
  ):
94
  st.session_state.messages.append(User(message=prompt).build_message())
95
  st.chat_message(ChatProfileRoleEnum.User).write(prompt)
 
71
  The main function that runs the Streamlit app.
72
  """
73
 
74
+ if st.secrets.OPENAI_API_KEY:
75
  openai_api_key = st.secrets.OPENAI_API_KEY
76
  else:
77
  openai_api_key = st.sidebar.text_input("OpenAI API Key", type="password")
 
89
 
90
  if prompt := st.chat_input(
91
  placeholder="Chat with your document",
92
+ disabled=(not openai_api_key),
93
  ):
94
  st.session_state.messages.append(User(message=prompt).build_message())
95
  st.chat_message(ChatProfileRoleEnum.User).write(prompt)