LeedsLibraries commited on
Commit
edbe581
·
verified ·
1 Parent(s): f84ec10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -0
app.py CHANGED
@@ -989,6 +989,89 @@ def process_query(prompt, context_docs):
989
  return clean_response, ", ".join(sorted(sources)) if sources else None, False, None
990
 
991
  # ====== STREAMLIT INTERFACE ======
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  st.title(APP_TITLE)
993
 
994
  # Sidebar
 
989
  return clean_response, ", ".join(sorted(sources)) if sources else None, False, None
990
 
991
  # ====== STREAMLIT INTERFACE ======
992
+
993
+ # Custom CSS for better visual appearance
994
+ st.markdown("""
995
+ <style>
996
+ /* Message bubbles - different colors for user vs assistant */
997
+ [data-testid="stChatMessageContent"] {
998
+ padding: 1rem;
999
+ border-radius: 0.5rem;
1000
+ }
1001
+
1002
+ /* User messages - light blue background */
1003
+ [data-testid="stChatMessage"][data-testid*="user"] {
1004
+ background-color: #E3F2FD;
1005
+ }
1006
+
1007
+ /* Assistant messages - light gray background */
1008
+ [data-testid="stChatMessage"]:not([data-testid*="user"]) {
1009
+ background-color: #F5F5F5;
1010
+ }
1011
+
1012
+ /* Sidebar sections styling */
1013
+ .stSidebar [data-testid="stMarkdownContainer"] {
1014
+ background-color: #FAFAFA;
1015
+ padding: 0.5rem;
1016
+ border-radius: 0.3rem;
1017
+ margin-bottom: 0.5rem;
1018
+ }
1019
+
1020
+ /* Settings section - light purple */
1021
+ .stSidebar .element-container:has(> [data-testid="stSelectbox"]) {
1022
+ background-color: #F3E5F5;
1023
+ padding: 1rem;
1024
+ border-radius: 0.5rem;
1025
+ margin-bottom: 1rem;
1026
+ }
1027
+
1028
+ /* Documents section header styling */
1029
+ .stSidebar h3 {
1030
+ color: #5E35B1;
1031
+ font-size: 1rem;
1032
+ font-weight: 600;
1033
+ }
1034
+
1035
+ /* Input area focus effect */
1036
+ [data-testid="stChatInput"] textarea:focus {
1037
+ background-color: #F1F8F4;
1038
+ border-color: #4CAF50;
1039
+ }
1040
+
1041
+ /* Info messages - light cyan for pronoun resolution */
1042
+ .stAlert[data-baseweb="notification"] {
1043
+ background-color: #E0F7FA;
1044
+ }
1045
+
1046
+ /* Success messages */
1047
+ [data-testid="stAlert"][kind="success"] {
1048
+ background-color: #E8F5E9;
1049
+ }
1050
+
1051
+ /* Error messages keep default red but soften */
1052
+ [data-testid="stAlert"][kind="error"] {
1053
+ background-color: #FFEBEE;
1054
+ }
1055
+
1056
+ /* Buttons styling */
1057
+ .stButton button {
1058
+ border-radius: 0.5rem;
1059
+ font-weight: 500;
1060
+ transition: all 0.3s ease;
1061
+ }
1062
+
1063
+ .stButton button:hover {
1064
+ transform: translateY(-2px);
1065
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
1066
+ }
1067
+
1068
+ /* Spinner text color */
1069
+ .stSpinner > div {
1070
+ border-top-color: #5E35B1 !important;
1071
+ }
1072
+ </style>
1073
+ """, unsafe_allow_html=True)
1074
+
1075
  st.title(APP_TITLE)
1076
 
1077
  # Sidebar