Wajahat698 commited on
Commit
3b1a5a5
·
verified ·
1 Parent(s): db5c113

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -103
app.py CHANGED
@@ -546,66 +546,6 @@ def delete_document(user_id, doc_id):
546
  except Exception as e:
547
  st.error(f"Error deleting document: {e}")
548
 
549
- def display_popup():
550
- # Custom CSS for the pop-up message
551
- popup_css = """
552
- <style>
553
- .custom-popup {
554
- background-color: #f9f9f9;
555
- color: #333;
556
- padding: 15px;
557
- border-radius: 8px;
558
- font-family: Arial, sans-serif;
559
- font-size: 14px;
560
- margin-top: 10px;
561
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
562
- }
563
- .custom-popup code {
564
- background-color: #e1e1e1;
565
- padding: 2px 4px;
566
- border-radius: 4px;
567
- color: #333;
568
- font-family: monospace;
569
- }
570
- .custom-popup b {
571
- color: #333;
572
- }
573
- .custom-popup i {
574
- color: #333;
575
- }
576
- </style>
577
- """
578
- # Inject custom CSS
579
- st.markdown(popup_css, unsafe_allow_html=True)
580
- # Display the pop-up message
581
- st.markdown("""
582
- <div class="custom-popup">
583
- <b>Here’s how you can save your TrustBuilder® using Trustifier AI:</b><br><br>
584
- 1. Type your TrustBuilder® in the chat.<br><br>
585
- 2. If you're unsure of the TrustBucket®, ask the AI:<br>
586
- <i>"Hey, which TrustBucket does this TrustBuilder® belong to?"</i><br><br>
587
- 3. Save it using the following format:<br>
588
- <code>Save this as a TrustBuilder. [BucketName]. [TrustBuilder Text]</code><br><br>
589
- <b>Example:</b><br>
590
- <code>Save this as a TrustBuilder. Stability. We focus on keeping and nurturing our team.</code>
591
- </div>
592
-
593
-
594
- """, unsafe_allow_html=True)
595
-
596
- # Initialize session state for button click
597
- if 'letai_allocate_clicked' not in st.session_state:
598
- st.session_state['letai_allocate_clicked'] = False
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
 
610
 
611
 
@@ -902,58 +842,80 @@ def side():
902
  st.warning("Please fill all fields")
903
 
904
  with col2:
905
- custom_button_css = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906
  <style>
907
- .custom-button {
908
  background-color: rgb(82, 129, 134);
909
  color: white;
910
- border: none;
911
- padding: 8px 16px;
912
- font-size: 14px;
913
- border-radius: 5px;
914
- cursor: pointer;
915
  font-family: Arial, sans-serif;
 
 
916
  }
917
- .custom-button:hover {
918
- background-color: rgb(70, 115, 119);
 
 
 
 
 
 
 
 
 
 
919
  }
920
  </style>
921
  """
922
- st.markdown(custom_button_css, unsafe_allow_html=True)
923
-
924
- # Create a unique ID for the button
925
- import uuid
926
- button_id = 'custom_button_' + str(uuid.uuid4()).replace('-', '')
927
-
928
- # HTML and JavaScript for the custom button
929
- custom_button_html = f"""
930
- <button class="custom-button" id="{button_id}">LetAI Allocate</button>
931
- <script>
932
- const btn = document.getElementById("{button_id}");
933
- btn.addEventListener("click", function() {{
934
- // Send a message to Streamlit to set a session state variable
935
- fetch('/_stcore/streamlit/report/session_state', {{
936
- method: 'POST',
937
- headers: {{
938
- 'Content-Type': 'application/json'
939
- }},
940
- body: JSON.stringify({{ 'letai_allocate_clicked': true }})
941
- }}).then((response) => {{
942
- window.location.reload();
943
- }});
944
- }});
945
- </script>
946
- """
947
- st.markdown(custom_button_html, unsafe_allow_html=True)
948
-
949
- # Check if the custom button was clicked
950
- if st.session_state['letai_allocate_clicked']:
951
- display_popup()
952
- # Reset the click state
953
- st.session_state['letai_allocate_clicked'] = False
954
 
955
-
956
- side()
957
  if st.session_state.get("wix_user_id") and "faiss_db" not in st.session_state:
958
  refresh_faiss_index()
959
 
 
546
  except Exception as e:
547
  st.error(f"Error deleting document: {e}")
548
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
 
550
 
551
 
 
842
  st.warning("Please fill all fields")
843
 
844
  with col2:
845
+ custom_css = """
846
+ <style>
847
+ button {
848
+ background-color: rgb(82, 129, 134) !important;
849
+ color: white !important;
850
+ border: none !important;
851
+ padding: 8px 16px !important;
852
+ font-size: 14px !important;
853
+ border-radius: 5px !important;
854
+ cursor: pointer !important;
855
+ font-family: Arial, sans-serif !important;
856
+ }
857
+ button:hover {
858
+ background-color: rgb(70, 115, 119) !important;
859
+ }
860
+ </style>
861
+ """
862
+ st.markdown(custom_css, unsafe_allow_html=True)
863
+ letai_allocate_clicked = st.button("LetAI Allocate", key="letai_allocate_button")
864
+
865
+ if letai_allocate_clicked:
866
+ # Display the pop-up message
867
+ popup_css = """
868
  <style>
869
+ .custom-popup {
870
  background-color: rgb(82, 129, 134);
871
  color: white;
872
+ padding: 15px;
873
+ border-radius: 8px;
 
 
 
874
  font-family: Arial, sans-serif;
875
+ font-size: 14px;
876
+ margin-top: 10px;
877
  }
878
+ .custom-popup code {
879
+ background-color: rgba(255, 255, 255, 0.2);
880
+ padding: 2px 4px;
881
+ border-radius: 4px;
882
+ color: white;
883
+ font-family: monospace;
884
+ }
885
+ .custom-popup b {
886
+ color: #FFD700; /* Gold color for emphasis */
887
+ }
888
+ .custom-popup i {
889
+ color: #FFFFFF;
890
  }
891
  </style>
892
  """
893
+ st.markdown(popup_css, unsafe_allow_html=True)
894
+ st.markdown("""
895
+ <div class="custom-popup">
896
+ <b>Here’s how you can save your TrustBuilder® using Trustifier AI:</b><br><br>
897
+ 1. Type your TrustBuilder® in the chat.<br><br>
898
+ 2. If you're unsure of the TrustBucket®, ask the AI:<br>
899
+ <i>"Hey, which TrustBucket does this TrustBuilder® belong to?"</i><br><br>
900
+ 3. Save it using the following format:<br>
901
+ <code>Save this as a TrustBuilder. [BucketName]. [TrustBuilder Text]</code><br><br>
902
+ <b>Example:</b><br>
903
+ <code>Save this as a TrustBuilder. Stability. We focus on keeping and nurturing our team.</code>
904
+ </div>
905
+ """, unsafe_allow_html=True)
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
 
 
 
 
 
 
 
918
 
 
 
919
  if st.session_state.get("wix_user_id") and "faiss_db" not in st.session_state:
920
  refresh_faiss_index()
921