Spaces:
Sleeping
Sleeping
John Graham Reynolds
commited on
Commit
·
110e7e0
1
Parent(s):
5c286aa
keep track of feedback in session_state
Browse files
app.py
CHANGED
|
@@ -66,6 +66,9 @@ with open("./style.css") as css:
|
|
| 66 |
if "messages" not in st.session_state:
|
| 67 |
st.session_state["messages"] = []
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
def clear_chat_history():
|
| 70 |
st.session_state["messages"] = []
|
| 71 |
|
|
@@ -241,6 +244,8 @@ def feedback():
|
|
| 241 |
|
| 242 |
main = st.container()
|
| 243 |
with main:
|
|
|
|
|
|
|
| 244 |
history = st.container(height=400)
|
| 245 |
with history:
|
| 246 |
for message in st.session_state["messages"]:
|
|
@@ -264,8 +269,10 @@ with main:
|
|
| 264 |
# with st.container():
|
| 265 |
gave_feedback = st.button('Give Feedback on Last Response', on_click=feedback)
|
| 266 |
if gave_feedback:
|
|
|
|
| 267 |
st.markdown("Feedback received! Thank you for your insight.")
|
| 268 |
-
|
|
|
|
| 269 |
|
| 270 |
|
| 271 |
with st.sidebar:
|
|
|
|
| 66 |
if "messages" not in st.session_state:
|
| 67 |
st.session_state["messages"] = []
|
| 68 |
|
| 69 |
+
if "feedback" not in st.session_state:
|
| 70 |
+
st.session_state["feedback"] = [None]
|
| 71 |
+
|
| 72 |
def clear_chat_history():
|
| 73 |
st.session_state["messages"] = []
|
| 74 |
|
|
|
|
| 244 |
|
| 245 |
main = st.container()
|
| 246 |
with main:
|
| 247 |
+
if st.session_state["feedback"][-1] is not None:
|
| 248 |
+
st.markdown("Feedback received! Thank you for your insight.")
|
| 249 |
history = st.container(height=400)
|
| 250 |
with history:
|
| 251 |
for message in st.session_state["messages"]:
|
|
|
|
| 269 |
# with st.container():
|
| 270 |
gave_feedback = st.button('Give Feedback on Last Response', on_click=feedback)
|
| 271 |
if gave_feedback:
|
| 272 |
+
st.session_state["feedback"].append("given")
|
| 273 |
st.markdown("Feedback received! Thank you for your insight.")
|
| 274 |
+
# time.sleep(3)
|
| 275 |
+
# add st.session_state["feedback"] var for keeping track of when the user gives feedback!
|
| 276 |
|
| 277 |
|
| 278 |
with st.sidebar:
|