Wajahat698 commited on
Commit
6ea869c
·
verified ·
1 Parent(s): abb3683

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -28
app.py CHANGED
@@ -666,25 +666,8 @@ def side():
666
  # Saved Documents Section
667
  st.sidebar.subheader("Saved documents")
668
  st.sidebar.text_area("Save documents like your brand tonality, key phrases, or segments here", height=80, disabled=True)
669
-
670
- # Scrollable container for saved documents
671
- scrollable_container_style = """
672
- <style>
673
- .scrollable-container {
674
- max-height: 300px;
675
- overflow-y: auto;
676
- border: 1px solid #ddd;
677
- padding: 10px;
678
- border-radius: 5px;
679
- }
680
- </style>
681
- """
682
- st.sidebar.markdown(scrollable_container_style, unsafe_allow_html=True)
683
- st.sidebar.markdown('<div class="scrollable-container">', unsafe_allow_html=True)
684
-
685
- # Fetch documents from Firebase
686
  docs = fetch_documents(st.session_state["wix_user_id"])
687
-
688
  if docs:
689
  for doc_id, doc_data in docs.items():
690
  st.sidebar.markdown(f"**Document ID:** {doc_id[:8]}")
@@ -692,16 +675,16 @@ def side():
692
  public_url = doc_data.get("public_url", "URL not available")
693
  if public_url != "URL not available":
694
  st.sidebar.markdown(f"[View Full Document]({public_url})", unsafe_allow_html=True)
695
-
696
- # Add delete button for the public URL
697
  if st.button(f"Delete: {doc_id[:8]}", key=f"del_{doc_id}"):
698
  delete_document(st.session_state["wix_user_id"], public_url)
699
  else:
700
  st.sidebar.write("No saved documents found.")
701
-
702
  st.sidebar.markdown('</div>', unsafe_allow_html=True)
703
-
704
  # File Upload Section
 
705
  col1, col2 = st.sidebar.columns([0.5, 0.5])
706
  with col1:
707
  uploaded_files = st.file_uploader("Upload PDF, DOCX, or TXT files", type=["pdf", "docx", "txt"], accept_multiple_files=True)
@@ -721,7 +704,7 @@ def side():
721
  st.sidebar.markdown(f"[View your knowledge base here]({public_url})", unsafe_allow_html=True)
722
  else:
723
  st.sidebar.warning("No valid files uploaded.")
724
-
725
  # Show My TrustBuilders Section
726
  st.sidebar.subheader("Show my TrustBuilders®")
727
  search_query = st.sidebar.text_input("Search by keyword", key="keyword")
@@ -729,7 +712,7 @@ def side():
729
  search_results = {k: v for k, v in st.session_state.get("TrustBuilder", {}).items() if search_query.lower() in v["message"].lower()}
730
  for result_id, result_data in search_results.items():
731
  st.sidebar.write(f"- {result_data['message'][:50]}")
732
-
733
  # Trust Bucket Selection
734
  st.sidebar.write("and choose the Trust Bucket®")
735
  trust_buckets = ["S", "D", "R", "B", "V", "C"]
@@ -739,19 +722,19 @@ def side():
739
  with cols[idx]:
740
  if st.button(f"{bucket}", key=f"bucket_{label}"):
741
  st.write(f"{label} Trust clicked")
742
-
743
  # Save TrustBuilders Section
744
  st.sidebar.subheader("Save TrustBuilders®")
745
- st.sidebar.text_input("Brand/Product/Person")
746
  trust_builder_text = st.sidebar.text_area("Type/paste Trust Builder®", height=100)
747
-
748
  # Allocate TrustBuilders to Buckets
749
  st.sidebar.write("Allocate to")
750
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
751
  with st.sidebar:
752
  if st.button(f"{bucket}", key=f"allocate_{label}"):
753
  save_content(st.session_state["wix_user_id"], trust_builder_text, trust_bucket=label)
754
-
755
  if st.sidebar.button("Let AI allocate"):
756
  st.write("AI allocated the Trust Bucket")
757
 
 
666
  # Saved Documents Section
667
  st.sidebar.subheader("Saved documents")
668
  st.sidebar.text_area("Save documents like your brand tonality, key phrases, or segments here", height=80, disabled=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
669
  docs = fetch_documents(st.session_state["wix_user_id"])
670
+
671
  if docs:
672
  for doc_id, doc_data in docs.items():
673
  st.sidebar.markdown(f"**Document ID:** {doc_id[:8]}")
 
675
  public_url = doc_data.get("public_url", "URL not available")
676
  if public_url != "URL not available":
677
  st.sidebar.markdown(f"[View Full Document]({public_url})", unsafe_allow_html=True)
678
+
679
+ # Add delete button for each document
680
  if st.button(f"Delete: {doc_id[:8]}", key=f"del_{doc_id}"):
681
  delete_document(st.session_state["wix_user_id"], public_url)
682
  else:
683
  st.sidebar.write("No saved documents found.")
 
684
  st.sidebar.markdown('</div>', unsafe_allow_html=True)
685
+
686
  # File Upload Section
687
+ st.sidebar.subheader("Upload New Documents")
688
  col1, col2 = st.sidebar.columns([0.5, 0.5])
689
  with col1:
690
  uploaded_files = st.file_uploader("Upload PDF, DOCX, or TXT files", type=["pdf", "docx", "txt"], accept_multiple_files=True)
 
704
  st.sidebar.markdown(f"[View your knowledge base here]({public_url})", unsafe_allow_html=True)
705
  else:
706
  st.sidebar.warning("No valid files uploaded.")
707
+
708
  # Show My TrustBuilders Section
709
  st.sidebar.subheader("Show my TrustBuilders®")
710
  search_query = st.sidebar.text_input("Search by keyword", key="keyword")
 
712
  search_results = {k: v for k, v in st.session_state.get("TrustBuilder", {}).items() if search_query.lower() in v["message"].lower()}
713
  for result_id, result_data in search_results.items():
714
  st.sidebar.write(f"- {result_data['message'][:50]}")
715
+
716
  # Trust Bucket Selection
717
  st.sidebar.write("and choose the Trust Bucket®")
718
  trust_buckets = ["S", "D", "R", "B", "V", "C"]
 
722
  with cols[idx]:
723
  if st.button(f"{bucket}", key=f"bucket_{label}"):
724
  st.write(f"{label} Trust clicked")
725
+
726
  # Save TrustBuilders Section
727
  st.sidebar.subheader("Save TrustBuilders®")
728
+ st.sidebar.text_input("Brand/Product/Person", key="brand_product")
729
  trust_builder_text = st.sidebar.text_area("Type/paste Trust Builder®", height=100)
730
+
731
  # Allocate TrustBuilders to Buckets
732
  st.sidebar.write("Allocate to")
733
  for idx, (bucket, label) in enumerate(zip(trust_buckets, bucket_labels)):
734
  with st.sidebar:
735
  if st.button(f"{bucket}", key=f"allocate_{label}"):
736
  save_content(st.session_state["wix_user_id"], trust_builder_text, trust_bucket=label)
737
+
738
  if st.sidebar.button("Let AI allocate"):
739
  st.write("AI allocated the Trust Bucket")
740