Spaces:
Sleeping
Sleeping
Handle secrets
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ def main():
|
|
71 |
The main function that runs the Streamlit app.
|
72 |
"""
|
73 |
|
74 |
-
if
|
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
|
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)
|