Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,9 @@ def isTrue(x) -> bool:
|
|
15 |
return x
|
16 |
return x.strip().lower() == 'true'
|
17 |
|
|
|
|
|
|
|
18 |
def launch_bot():
|
19 |
def generate_response(question):
|
20 |
response = vq.submit_query(question)
|
@@ -78,21 +81,13 @@ def launch_bot():
|
|
78 |
if "messages" not in st.session_state.keys():
|
79 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
80 |
|
81 |
-
|
82 |
-
st.session_state.feedback_key = 0
|
83 |
|
84 |
# Display chat messages
|
85 |
for message in st.session_state.messages:
|
86 |
with st.chat_message(message["role"]):
|
87 |
st.write(message["content"])
|
88 |
|
89 |
-
if (message["role"] == "assistant") & (not st.session_state.first_turn):
|
90 |
-
feedback = streamlit_feedback(feedback_type="thumbs", key = st.session_state.feedback_key)
|
91 |
-
print(f"DEBUG: Feedback key: {st.session_state.feedback_key}")
|
92 |
-
if feedback:
|
93 |
-
st.write(feedback)
|
94 |
-
st.session_state.feedback_key += 1
|
95 |
-
|
96 |
example_container = st.empty()
|
97 |
with example_container:
|
98 |
if show_example_questions():
|
@@ -123,6 +118,12 @@ def launch_bot():
|
|
123 |
message = {"role": "assistant", "content": response}
|
124 |
st.session_state.messages.append(message)
|
125 |
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
if __name__ == "__main__":
|
128 |
launch_bot()
|
|
|
15 |
return x
|
16 |
return x.strip().lower() == 'true'
|
17 |
|
18 |
+
if "feedback_key" not in st.session_state:
|
19 |
+
st.session_state.feedback_key = 0
|
20 |
+
|
21 |
def launch_bot():
|
22 |
def generate_response(question):
|
23 |
response = vq.submit_query(question)
|
|
|
81 |
if "messages" not in st.session_state.keys():
|
82 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
83 |
|
84 |
+
|
|
|
85 |
|
86 |
# Display chat messages
|
87 |
for message in st.session_state.messages:
|
88 |
with st.chat_message(message["role"]):
|
89 |
st.write(message["content"])
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
example_container = st.empty()
|
92 |
with example_container:
|
93 |
if show_example_questions():
|
|
|
118 |
message = {"role": "assistant", "content": response}
|
119 |
st.session_state.messages.append(message)
|
120 |
st.rerun()
|
121 |
+
|
122 |
+
feedback = streamlit_feedback(feedback_type="thumbs", key = st.session_state.feedback_key)
|
123 |
+
print(f"DEBUG: Feedback key: {st.session_state.feedback_key}")
|
124 |
+
# if feedback:
|
125 |
+
# st.write(feedback)
|
126 |
+
st.session_state.feedback_key += 1
|
127 |
|
128 |
if __name__ == "__main__":
|
129 |
launch_bot()
|