Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -674,51 +674,51 @@ def side():
|
|
| 674 |
st.sidebar.header("TrustVault®")
|
| 675 |
|
| 676 |
st.subheader("Saved Documents")
|
| 677 |
-
st.markdown("""
|
| 678 |
<style>
|
| 679 |
.scrollable-container {
|
| 680 |
-
max-height:
|
| 681 |
overflow-y: auto;
|
| 682 |
border: 1px solid gray;
|
| 683 |
padding: 10px;
|
| 684 |
border-radius: 5px;
|
| 685 |
background-color: #f9f9f9;
|
| 686 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
</style>
|
| 688 |
""", unsafe_allow_html=True)
|
| 689 |
-
st.markdown('<div class="scrollable-container">', unsafe_allow_html=True)
|
| 690 |
|
| 691 |
-
#
|
|
|
|
| 692 |
try:
|
| 693 |
docs = db.child("users").child(user_id).child("KnowledgeBase").get().val()
|
| 694 |
if docs:
|
| 695 |
for doc_id, doc_data in docs.items():
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
with col2:
|
| 700 |
-
if st.button("Delete", key=f"delete_{doc_id}"):
|
| 701 |
-
delete_document(user_id, doc_id)
|
| 702 |
else:
|
| 703 |
-
st.write("No saved documents found.")
|
| 704 |
except Exception as e:
|
| 705 |
-
st.error(f"Error fetching documents: {e}")
|
|
|
|
| 706 |
|
| 707 |
-
|
|
|
|
|
|
|
| 708 |
|
| 709 |
-
#
|
| 710 |
-
st.
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
"content": uploaded_file.name
|
| 718 |
-
})
|
| 719 |
-
st.success(f"File '{uploaded_file.name}' uploaded successfully!")
|
| 720 |
-
except Exception as e:
|
| 721 |
-
st.error(f"Error uploading file: {e}")
|
| 722 |
|
| 723 |
# Show Trust Builders Section
|
| 724 |
st.subheader("Show My TrustBuilders®")
|
|
|
|
| 674 |
st.sidebar.header("TrustVault®")
|
| 675 |
|
| 676 |
st.subheader("Saved Documents")
|
| 677 |
+
st.sidebar.markdown("""
|
| 678 |
<style>
|
| 679 |
.scrollable-container {
|
| 680 |
+
max-height: 200px;
|
| 681 |
overflow-y: auto;
|
| 682 |
border: 1px solid gray;
|
| 683 |
padding: 10px;
|
| 684 |
border-radius: 5px;
|
| 685 |
background-color: #f9f9f9;
|
| 686 |
}
|
| 687 |
+
.button-container {
|
| 688 |
+
display: flex;
|
| 689 |
+
justify-content: flex-end;
|
| 690 |
+
margin-top: 10px;
|
| 691 |
+
}
|
| 692 |
</style>
|
| 693 |
""", unsafe_allow_html=True)
|
|
|
|
| 694 |
|
| 695 |
+
# Scrollable container for saved documents
|
| 696 |
+
st.sidebar.markdown('<div class="scrollable-container">', unsafe_allow_html=True)
|
| 697 |
try:
|
| 698 |
docs = db.child("users").child(user_id).child("KnowledgeBase").get().val()
|
| 699 |
if docs:
|
| 700 |
for doc_id, doc_data in docs.items():
|
| 701 |
+
st.sidebar.markdown(f"**{doc_data.get('content', 'Document')}**")
|
| 702 |
+
if st.sidebar.button("Delete", key=f"delete_{doc_id}"):
|
| 703 |
+
delete_document(user_id, doc_id)
|
|
|
|
|
|
|
|
|
|
| 704 |
else:
|
| 705 |
+
st.sidebar.write("No saved documents found.")
|
| 706 |
except Exception as e:
|
| 707 |
+
st.sidebar.error(f"Error fetching documents: {e}")
|
| 708 |
+
st.sidebar.markdown('</div>', unsafe_allow_html=True)
|
| 709 |
|
| 710 |
+
# Buttons aligned beneath the text area
|
| 711 |
+
st.sidebar.markdown('<div class="button-container">', unsafe_allow_html=True)
|
| 712 |
+
uploaded_file = st.sidebar.file_uploader("", label_visibility="collapsed", type=["pdf", "docx", "txt"])
|
| 713 |
|
| 714 |
+
# Compact Upload Button
|
| 715 |
+
if st.sidebar.button("Upload"):
|
| 716 |
+
if uploaded_file:
|
| 717 |
+
save_document(user_id, uploaded_file.name)
|
| 718 |
+
else:
|
| 719 |
+
st.sidebar.warning("Please select a file to upload.")
|
| 720 |
+
st.sidebar.markdown('</div>', unsafe_allow_html=True)
|
| 721 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 722 |
|
| 723 |
# Show Trust Builders Section
|
| 724 |
st.subheader("Show My TrustBuilders®")
|