Yara Kyrychenko
commited on
Commit
Β·
bf91c0c
1
Parent(s):
5ff66b8
update text
Browse files
app.py
CHANGED
|
@@ -98,7 +98,7 @@ def setup_messages():
|
|
| 98 |
st.session_state.messages = [{ "role": "system", "content": st.session_state.system_message}]
|
| 99 |
st.session_state.convo_start_time = datetime.now()
|
| 100 |
|
| 101 |
-
client = OpenAI(
|
| 102 |
|
| 103 |
### App interface
|
| 104 |
with st.sidebar:
|
|
@@ -107,22 +107,25 @@ with st.sidebar:
|
|
| 107 |
{"β" if st.session_state.submitted else "β"} **Step 1. Complete a form**
|
| 108 |
|
| 109 |
{"β" if len(st.session_state.messages) > 0 else "β"} **Step 2. Type in the chat box to start a conversation**""")
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
st.markdown(f"""
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
β If you encounter any technical issues, please let us know. It might sometimes take 30 seconds or more to generate a response, so please be patient.
|
| 118 |
|
| 119 |
-
{"β" if st.session_state.inserted > 1 else "β"} **Step 3. Use the *
|
| 120 |
|
| 121 |
-
β οΈ Do not forget to copy & paste your chatbot
|
| 122 |
|
| 123 |
βΊ You can always return to this panel by clicking the arrow on the top left.
|
| 124 |
|
| 125 |
-
{"π **All done! Please enter your
|
| 126 |
""")
|
| 127 |
if st.session_state.gotit == False or st.session_state.submitted == False:
|
| 128 |
st.session_state.gotit = st.button("Let's start!", key=None, help=None, use_container_width=True)
|
|
@@ -185,13 +188,15 @@ elif st.session_state.submitted == False:
|
|
| 185 |
pass
|
| 186 |
|
| 187 |
elif st.session_state.inserted > 1:
|
| 188 |
-
st.markdown("## Copy your
|
| 189 |
-
st.markdown('**Your chatbot
|
| 190 |
-
st.markdown(f'##
|
| 191 |
-
st.markdown('**Please copy the
|
| 192 |
|
| 193 |
elif prompt := st.chat_input("Ask a polarizing question..."):
|
| 194 |
|
|
|
|
|
|
|
| 195 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 196 |
with st.chat_message("user"):
|
| 197 |
st.markdown(prompt)
|
|
@@ -225,7 +230,7 @@ elif prompt := st.chat_input("Ask a polarizing question..."):
|
|
| 225 |
if len(st.session_state.messages) > 10 or st.session_state.max_messages == len(st.session_state.messages):
|
| 226 |
columns = st.columns((1,1,1))
|
| 227 |
with columns[2]:
|
| 228 |
-
if st.button("
|
| 229 |
keys = ["inserted", "messages", "convo_start_time"]
|
| 230 |
|
| 231 |
st.session_state.user_data.update({key: st.session_state[key] for key in keys})
|
|
|
|
| 98 |
st.session_state.messages = [{ "role": "system", "content": st.session_state.system_message}]
|
| 99 |
st.session_state.convo_start_time = datetime.now()
|
| 100 |
|
| 101 |
+
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=st.secrets["OPENROUTER_API_KEY"])
|
| 102 |
|
| 103 |
### App interface
|
| 104 |
with st.sidebar:
|
|
|
|
| 107 |
{"β" if st.session_state.submitted else "β"} **Step 1. Complete a form**
|
| 108 |
|
| 109 |
{"β" if len(st.session_state.messages) > 0 else "β"} **Step 2. Type in the chat box to start a conversation**""")
|
| 110 |
+
|
| 111 |
+
st.success("Ask, request, or talk to the chatbot about something you consider **politically polarizing** or something that people from different US political parties might disagree about.", icon='π―')
|
| 112 |
+
|
| 113 |
+
st.markdown("π Some example topics include gun laws, abortion, and immigration.")
|
| 114 |
|
| 115 |
st.markdown(f"""
|
| 116 |
+
β οΈ You must respond **at least 5 times** before you will see a *Submit Interaction* button. You can continue before submitting, but **you must Submit Interaction and enter your chatbot word to proceed with the survey**.
|
| 117 |
|
| 118 |
+
β Do not share any personal information (e.g., name or address). Do not use AI tools to generate your responses; write them yourself.
|
| 119 |
|
| 120 |
β If you encounter any technical issues, please let us know. It might sometimes take 30 seconds or more to generate a response, so please be patient.
|
| 121 |
|
| 122 |
+
{"β" if st.session_state.inserted > 1 else "β"} **Step 3. Use the *Submit Interaction* button to get your chatbot word**
|
| 123 |
|
| 124 |
+
β οΈ Do not forget to copy & paste your chatbot WORD!
|
| 125 |
|
| 126 |
βΊ You can always return to this panel by clicking the arrow on the top left.
|
| 127 |
|
| 128 |
+
{"π **All done! Please enter your WORD in the survey and press *Next*.**" if st.session_state.inserted > 1 else ""}
|
| 129 |
""")
|
| 130 |
if st.session_state.gotit == False or st.session_state.submitted == False:
|
| 131 |
st.session_state.gotit = st.button("Let's start!", key=None, help=None, use_container_width=True)
|
|
|
|
| 188 |
pass
|
| 189 |
|
| 190 |
elif st.session_state.inserted > 1:
|
| 191 |
+
st.markdown("## Copy your WORD!")
|
| 192 |
+
st.markdown('**Your chatbot WORD is:**')
|
| 193 |
+
st.markdown(f'## POTATOES')
|
| 194 |
+
st.markdown('**Please copy the WORD and enter it into the survey field below.**')
|
| 195 |
|
| 196 |
elif prompt := st.chat_input("Ask a polarizing question..."):
|
| 197 |
|
| 198 |
+
st.success("Ask, request, or talk to the chatbot about something you consider **politically polarizing** or something that people from different US political parties might disagree about it.", icon='π―')
|
| 199 |
+
|
| 200 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 201 |
with st.chat_message("user"):
|
| 202 |
st.markdown(prompt)
|
|
|
|
| 230 |
if len(st.session_state.messages) > 10 or st.session_state.max_messages == len(st.session_state.messages):
|
| 231 |
columns = st.columns((1,1,1))
|
| 232 |
with columns[2]:
|
| 233 |
+
if st.button("Submit Interaction",use_container_width=True):
|
| 234 |
keys = ["inserted", "messages", "convo_start_time"]
|
| 235 |
|
| 236 |
st.session_state.user_data.update({key: st.session_state[key] for key in keys})
|