Update app.py
Browse files
app.py
CHANGED
|
@@ -68,8 +68,8 @@ if uploaded_file is not None:
|
|
| 68 |
st.session_state.chat_history = []
|
| 69 |
st.success("Chat history cleared.")
|
| 70 |
|
| 71 |
-
# Display chat history
|
| 72 |
-
for q, r in st.session_state.chat_history:
|
| 73 |
st.write(f"**You:** {q}")
|
| 74 |
if "Error" in r or "Sorry" in r:
|
| 75 |
st.error(r)
|
|
@@ -77,6 +77,9 @@ if uploaded_file is not None:
|
|
| 77 |
st.write(f"**Bot:** {r}")
|
| 78 |
with st.expander("See retrieved contexts"):
|
| 79 |
st.write(retrieved_contexts)
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
else:
|
| 82 |
st.write("📂 Please upload a PDF file to start the chat.")
|
|
|
|
| 68 |
st.session_state.chat_history = []
|
| 69 |
st.success("Chat history cleared.")
|
| 70 |
|
| 71 |
+
# Display chat history with feedback
|
| 72 |
+
for i, (q, r) in enumerate(st.session_state.chat_history):
|
| 73 |
st.write(f"**You:** {q}")
|
| 74 |
if "Error" in r or "Sorry" in r:
|
| 75 |
st.error(r)
|
|
|
|
| 77 |
st.write(f"**Bot:** {r}")
|
| 78 |
with st.expander("See retrieved contexts"):
|
| 79 |
st.write(retrieved_contexts)
|
| 80 |
+
if st.button("Flag as Incorrect", key=f"flag_{i}"):
|
| 81 |
+
logger.info(f"Flagged response: Q: {q}, R: {r}")
|
| 82 |
+
st.warning("Thanks for your feedback! We'll review this response.")
|
| 83 |
|
| 84 |
else:
|
| 85 |
st.write("📂 Please upload a PDF file to start the chat.")
|