Engr-Usman-Ali commited on
Commit
9976ba7
Β·
verified Β·
1 Parent(s): 8988fb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -32,17 +32,17 @@ if huggingface_api_key:
32
  # Session State
33
  # =======================
34
  if "projects" not in st.session_state:
35
- st.session_state.projects = {"Chat 1": {"tab": "generate", "history": []}}
36
  if "active_project" not in st.session_state:
37
- st.session_state.active_project = "Chat 1"
38
 
39
 
40
  # =======================
41
- # Sidebar Project Manager (Fixed)
42
  # =======================
43
  st.sidebar.title("πŸ“‚ Chats / Projects")
44
 
45
- # πŸ”₯ Make sidebar fixed
46
  st.markdown(
47
  """
48
  <style>
@@ -54,8 +54,14 @@ st.markdown(
54
  height: 100vh !important;
55
  overflow-y: auto !important; /* scroll if too many chats */
56
  padding-bottom: 2rem;
 
 
 
 
 
 
 
57
  }
58
- [data-testid="stSidebarNav"] {display: none;} /* remove default nav spacing */
59
  </style>
60
  """,
61
  unsafe_allow_html=True
@@ -88,6 +94,7 @@ with st.sidebar:
88
  st.session_state.active_project = new_name
89
  st.rerun()
90
 
 
91
  # =======================
92
  # Sidebar API Settings
93
  # =======================
 
32
  # Session State
33
  # =======================
34
  if "projects" not in st.session_state:
35
+ st.session_state.projects = {"Default Chat": {"tab": "generate", "history": []}}
36
  if "active_project" not in st.session_state:
37
+ st.session_state.active_project = "Default Chat"
38
 
39
 
40
  # =======================
41
+ # Sidebar Project Manager (Fixed + Independent Scroll)
42
  # =======================
43
  st.sidebar.title("πŸ“‚ Chats / Projects")
44
 
45
+ # πŸ”₯ CSS fix: sidebar fixed + main content shifted
46
  st.markdown(
47
  """
48
  <style>
 
54
  height: 100vh !important;
55
  overflow-y: auto !important; /* scroll if too many chats */
56
  padding-bottom: 2rem;
57
+ width: 300px !important; /* fixed sidebar width */
58
+ }
59
+ [data-testid="stSidebarNav"] {display: none;} /* remove extra nav space */
60
+
61
+ /* shift main content so it’s not hidden under sidebar */
62
+ .main {
63
+ margin-left: 300px !important;
64
  }
 
65
  </style>
66
  """,
67
  unsafe_allow_html=True
 
94
  st.session_state.active_project = new_name
95
  st.rerun()
96
 
97
+
98
  # =======================
99
  # Sidebar API Settings
100
  # =======================