@@ -128,8 +128,8 @@ def render_sidebar():
128
128
129
129
st .header ("Chat History" )
130
130
131
- # New chat button
132
- if st .button ("New Chat" , use_container_width = True , type = "primary" ):
131
+ # New chat button - prominent golden button
132
+ if st .button ("➕ New Chat" , use_container_width = True , type = "primary" ):
133
133
# Stop any ongoing generation before creating new chat
134
134
if st .session_state .get ('generating' , False ):
135
135
st .session_state .stop_generation = True
@@ -141,47 +141,69 @@ def render_sidebar():
141
141
142
142
st .divider ()
143
143
144
- # Chat history
144
+ # Chat history using container with custom styling
145
145
sorted_chats = st .session_state .chat_manager .get_sorted_chats ()
146
146
if sorted_chats :
147
147
for chat_id , chat_session in sorted_chats :
148
- col1 , col2 = st .columns ([ 4 , 1 ])
148
+ is_current = chat_id == st .session_state . chat_manager . current_chat_id
149
149
150
- with col1 :
151
- is_current = chat_id == st .session_state .chat_manager .current_chat_id
152
- button_type = "primary" if is_current else "secondary"
150
+ # Create a container for each chat item
151
+ chat_container = st .container ()
152
+ with chat_container :
153
+ col1 , col2 = st .columns ([4 , 1 ])
153
154
154
- if st .button (chat_session .title , key = f"chat-{ chat_id } " ,
155
- use_container_width = True , type = button_type ):
156
- # Stop any ongoing generation before switching
157
- if st .session_state .get ('generating' , False ):
158
- st .session_state .stop_generation = True
159
- st .session_state .generating = False
160
- logger .info ("Stopped ongoing generation due to chat switch" )
161
-
162
- # Switch to the chat
163
- st .session_state .chat_manager .switch_to_chat (chat_id )
164
-
165
- # Load the appropriate document for this chat if it has one
166
- if chat_session .document_id and st .session_state .rag_system :
167
- try :
168
- success = st .session_state .rag_system .load_document (chat_session .document_id )
169
- if success :
170
- logger .info (f"Loaded document { chat_session .document_id } for chat { chat_id } " )
171
- else :
172
- logger .warning (f"Could not load document { chat_session .document_id } for chat { chat_id } " )
173
- except Exception as e :
174
- logger .error (f"Error loading document for chat { chat_id } : { e } " )
175
-
176
- st .rerun ()
177
-
178
- with col2 :
179
- if st .button ("×" , key = f"del-{ chat_id } " , help = "Delete" ):
180
- # Stop any ongoing generation before deleting chat
181
- if st .session_state .get ('generating' , False ):
182
- st .session_state .stop_generation = True
183
- st .session_state .generating = False
184
- logger .info ("Stopped ongoing generation due to chat deletion" )
185
-
186
- st .session_state .chat_manager .delete_chat (chat_id )
187
- st .rerun ()
155
+ with col1 :
156
+ # All chats use the same emoji, different styling for selection
157
+ if is_current :
158
+ # Current chat - highlighted with primary styling
159
+ st .button (
160
+ f"💬 { chat_session .title } " ,
161
+ key = f"chat-{ chat_id } " ,
162
+ use_container_width = True ,
163
+ type = "primary" ,
164
+ help = "Current chat" ,
165
+ disabled = True # Disabled to show it's selected
166
+ )
167
+ else :
168
+ # Inactive chat - secondary styling
169
+ if st .button (
170
+ f"💬 { chat_session .title } " ,
171
+ key = f"chat-{ chat_id } " ,
172
+ use_container_width = True ,
173
+ type = "secondary" ,
174
+ help = "Click to switch to this chat"
175
+ ):
176
+ # Stop any ongoing generation before switching
177
+ if st .session_state .get ('generating' , False ):
178
+ st .session_state .stop_generation = True
179
+ st .session_state .generating = False
180
+ logger .info ("Stopped ongoing generation due to chat switch" )
181
+
182
+ # Switch to the chat
183
+ st .session_state .chat_manager .switch_to_chat (chat_id )
184
+
185
+ # Load the appropriate document for this chat if it has one
186
+ if chat_session .document_id and st .session_state .rag_system :
187
+ try :
188
+ success = st .session_state .rag_system .load_document (chat_session .document_id )
189
+ if success :
190
+ logger .info (f"Loaded document { chat_session .document_id } for chat { chat_id } " )
191
+ else :
192
+ logger .warning (f"Could not load document { chat_session .document_id } for chat { chat_id } " )
193
+ except Exception as e :
194
+ logger .error (f"Error loading document for chat { chat_id } : { e } " )
195
+
196
+ st .rerun ()
197
+
198
+ with col2 :
199
+ if st .button ("×" , key = f"del-{ chat_id } " , help = "Delete" , type = "secondary" ):
200
+ # Stop any ongoing generation before deleting chat
201
+ if st .session_state .get ('generating' , False ):
202
+ st .session_state .stop_generation = True
203
+ st .session_state .generating = False
204
+ logger .info ("Stopped ongoing generation due to chat deletion" )
205
+
206
+ st .session_state .chat_manager .delete_chat (chat_id )
207
+ st .rerun ()
208
+ else :
209
+ st .write ("*No chat history yet*" )
0 commit comments