Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,28 +87,27 @@ def main():
|
|
| 87 |
st.session_state.chat_history = []
|
| 88 |
st.rerun()
|
| 89 |
# Main chat interface
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
st.divider()
|
| 98 |
# Chat input
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
else:
|
| 113 |
# Show example questions
|
| 114 |
st.subheader("Các câu hỏi bạn có thể hỏi:")
|
|
|
|
| 87 |
st.session_state.chat_history = []
|
| 88 |
st.rerun()
|
| 89 |
# Main chat interface
|
| 90 |
+
st.header("💬 Ask About Your Insurance Policy")
|
| 91 |
+
# Display chat history
|
| 92 |
+
for i, (question, answer) in enumerate(st.session_state.chat_history):
|
| 93 |
+
with st.container():
|
| 94 |
+
st.markdown(f"**You:** {question}")
|
| 95 |
+
st.markdown(f"**Insurance Assistant:** {answer}")
|
| 96 |
+
st.divider()
|
|
|
|
| 97 |
# Chat input
|
| 98 |
+
user_question = st.chat_input("Hãy đặt những câu hỏi về hợp đồng bảo hiểm cơ bản...")
|
| 99 |
+
if user_question:
|
| 100 |
+
with st.spinner("Analyzing your policy..."):
|
| 101 |
+
# Get response from chatbot
|
| 102 |
+
response = st.session_state.chatbot.chat_with_pdf(
|
| 103 |
+
user_question,
|
| 104 |
+
st.session_state.chatbot.pdf_content
|
| 105 |
+
)
|
| 106 |
+
# Add to chat history
|
| 107 |
+
st.session_state.chat_history.append((user_question, response))
|
| 108 |
+
# Display the new response
|
| 109 |
+
st.markdown(f"**You:** {user_question}")
|
| 110 |
+
st.markdown(f"**Insurance Assistant:** {response}")
|
| 111 |
else:
|
| 112 |
# Show example questions
|
| 113 |
st.subheader("Các câu hỏi bạn có thể hỏi:")
|