Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -43,11 +43,11 @@ def thumbs_feedback(feedback, **kwargs):
|
|
43 |
}
|
44 |
}]
|
45 |
}
|
46 |
-
response = requests.post('https://api2.amplitude.com/2/httpapi', headers=headers, data=json.dumps(data))
|
47 |
-
if response.status_code == 200:
|
48 |
-
|
49 |
-
else:
|
50 |
-
|
51 |
|
52 |
st.session_state.feedback_key += 1
|
53 |
|
@@ -169,17 +169,20 @@ def launch_bot():
|
|
169 |
}
|
170 |
}]
|
171 |
}
|
172 |
-
response = requests.post('https://api2.amplitude.com/2/httpapi', headers=headers, data=json.dumps(data))
|
173 |
-
if response.status_code == 200:
|
174 |
-
|
175 |
-
else:
|
176 |
-
|
177 |
|
178 |
st.session_state.ex_prompt = None
|
179 |
st.session_state.prompt = None
|
180 |
st.session_state.first_turn = False
|
181 |
st.rerun()
|
182 |
|
|
|
|
|
|
|
183 |
if (st.session_state.messages[-1]["role"] == "assistant") & (st.session_state.messages[-1]["content"] != "How may I help you?"):
|
184 |
streamlit_feedback(feedback_type="thumbs", on_submit = thumbs_feedback, key = st.session_state.feedback_key,
|
185 |
kwargs = {"prompt": st.session_state.messages[-2]["content"], "response": st.session_state.messages[-1]["content"]})
|
|
|
43 |
}
|
44 |
}]
|
45 |
}
|
46 |
+
# response = requests.post('https://api2.amplitude.com/2/httpapi', headers=headers, data=json.dumps(data))
|
47 |
+
# if response.status_code == 200:
|
48 |
+
# print(f"DEBUG: Request successfully sent: {response.json()}")
|
49 |
+
# else:
|
50 |
+
# print(f"DEBUG: Request failed with status code {response.status_code}. Response Text: {response.text}")
|
51 |
|
52 |
st.session_state.feedback_key += 1
|
53 |
|
|
|
169 |
}
|
170 |
}]
|
171 |
}
|
172 |
+
# response = requests.post('https://api2.amplitude.com/2/httpapi', headers=headers, data=json.dumps(data))
|
173 |
+
# if response.status_code == 200:
|
174 |
+
# print(f"DEBUG: Request successfully sent: {response.json()}")
|
175 |
+
# else:
|
176 |
+
# print(f"DEBUG: Request failed with status code {response.status_code}. Response Text: {response.text}")
|
177 |
|
178 |
st.session_state.ex_prompt = None
|
179 |
st.session_state.prompt = None
|
180 |
st.session_state.first_turn = False
|
181 |
st.rerun()
|
182 |
|
183 |
+
for i, message in enumerate(st.session_state.messages):
|
184 |
+
print(f"DEBUG: Message {i}, {message}")
|
185 |
+
|
186 |
if (st.session_state.messages[-1]["role"] == "assistant") & (st.session_state.messages[-1]["content"] != "How may I help you?"):
|
187 |
streamlit_feedback(feedback_type="thumbs", on_submit = thumbs_feedback, key = st.session_state.feedback_key,
|
188 |
kwargs = {"prompt": st.session_state.messages[-2]["content"], "response": st.session_state.messages[-1]["content"]})
|