Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -695,12 +695,12 @@ def side():
|
|
| 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(
|
| 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(
|
| 704 |
else:
|
| 705 |
st.sidebar.write("No saved documents found.")
|
| 706 |
except Exception as e:
|
|
@@ -709,12 +709,12 @@ def side():
|
|
| 709 |
|
| 710 |
# Buttons aligned beneath the text area
|
| 711 |
st.sidebar.markdown('<div class="button-container">', unsafe_allow_html=True)
|
| 712 |
-
uploaded_file = st.
|
| 713 |
|
| 714 |
# Compact Upload Button
|
| 715 |
if st.sidebar.button("Upload"):
|
| 716 |
if uploaded_file:
|
| 717 |
-
save_document(
|
| 718 |
else:
|
| 719 |
st.sidebar.warning("Please select a file to upload.")
|
| 720 |
st.sidebar.markdown('</div>', unsafe_allow_html=True)
|
|
@@ -728,7 +728,7 @@ def side():
|
|
| 728 |
|
| 729 |
if st.button("Show"):
|
| 730 |
st.write(f"Filtering TrustBuilders for keyword='{search_query}' and bucket='{selected_bucket}'")
|
| 731 |
-
trustbuilders = fetch_trustbuilders(
|
| 732 |
results = []
|
| 733 |
for trustbuilder_id, data in trustbuilders.items():
|
| 734 |
content = data.get("content", "")
|
|
@@ -749,7 +749,7 @@ def side():
|
|
| 749 |
|
| 750 |
if st.button("Save"):
|
| 751 |
if trust_builder_text.strip() and selected_save_bucket:
|
| 752 |
-
save_trustbuilder(
|
| 753 |
else:
|
| 754 |
st.warning("Please fill all fields before saving.")
|
| 755 |
|
|
|
|
| 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(st.session_state["wix_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(st.session_state["wix_user_id"], doc_id)
|
| 704 |
else:
|
| 705 |
st.sidebar.write("No saved documents found.")
|
| 706 |
except Exception as e:
|
|
|
|
| 709 |
|
| 710 |
# Buttons aligned beneath the text area
|
| 711 |
st.sidebar.markdown('<div class="button-container">', unsafe_allow_html=True)
|
| 712 |
+
uploaded_file = st.file_uploader("")
|
| 713 |
|
| 714 |
# Compact Upload Button
|
| 715 |
if st.sidebar.button("Upload"):
|
| 716 |
if uploaded_file:
|
| 717 |
+
save_document(st.sess, uploaded_file.name)
|
| 718 |
else:
|
| 719 |
st.sidebar.warning("Please select a file to upload.")
|
| 720 |
st.sidebar.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
| 728 |
|
| 729 |
if st.button("Show"):
|
| 730 |
st.write(f"Filtering TrustBuilders for keyword='{search_query}' and bucket='{selected_bucket}'")
|
| 731 |
+
trustbuilders = fetch_trustbuilders(st.session_state["wix_user_id"])
|
| 732 |
results = []
|
| 733 |
for trustbuilder_id, data in trustbuilders.items():
|
| 734 |
content = data.get("content", "")
|
|
|
|
| 749 |
|
| 750 |
if st.button("Save"):
|
| 751 |
if trust_builder_text.strip() and selected_save_bucket:
|
| 752 |
+
save_trustbuilder(st.session_state["wix_user_id"], trust_builder_text.strip(), selected_save_bucket)
|
| 753 |
else:
|
| 754 |
st.warning("Please fill all fields before saving.")
|
| 755 |
|