uumerrr684 commited on
Commit
2079a51
Β·
verified Β·
1 Parent(s): c92b0f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -11
app.py CHANGED
@@ -13,7 +13,7 @@ st.set_page_config(
13
  initial_sidebar_state="expanded" # Changed to show chat history by default
14
  )
15
 
16
- # Enhanced CSS with chat history styling
17
  st.markdown("""
18
  <style>
19
  .stApp {
@@ -40,6 +40,32 @@ st.markdown("""
40
  font-style: italic;
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  /* Chat history styling */
44
  .chat-history-item {
45
  padding: 8px 12px;
@@ -332,8 +358,7 @@ def start_new_chat():
332
  def get_user_id():
333
  """Get unique ID for this user session"""
334
  if 'user_id' not in st.session_state:
335
- st.session_state.user_id = str(uuid.uuid4())[
336
- :8] # Short ID for family use
337
  return st.session_state.user_id
338
 
339
 
@@ -498,12 +523,9 @@ def get_ai_response(messages, model="openai/gpt-3.5-turbo"):
498
  st.title("Chat Flow πŸ•·")
499
  st.caption("10 powerful Models, one simple chat.")
500
 
501
- # Sidebar with Chat History
502
  with st.sidebar:
503
- # NEW: Chat History Section at the top
504
- st.header("πŸ’¬ Chat History")
505
-
506
- # New Chat Button
507
  if st.button("βž• New Chat", use_container_width=True, type="primary"):
508
  start_new_chat()
509
  st.rerun()
@@ -550,7 +572,7 @@ with st.sidebar:
550
  st.rerun()
551
 
552
  with col_delete:
553
- if st.button("πŸ—‘οΈ", key=f"delete_{session_id}"):
554
  delete_session(session_id)
555
  # If deleted session was current, start new chat
556
  if session_id == current_session_id:
@@ -709,8 +731,6 @@ with st.sidebar:
709
  st.success("Chat cleared!")
710
  st.rerun()
711
 
712
- # Show welcome message when no messages
713
-
714
  # Display chat messages
715
  for message in st.session_state.messages:
716
  with st.chat_message(message["role"]):
 
13
  initial_sidebar_state="expanded" # Changed to show chat history by default
14
  )
15
 
16
+ # Enhanced CSS with chat history styling and BLACK NEW CHAT BUTTON
17
  st.markdown("""
18
  <style>
19
  .stApp {
 
40
  font-style: italic;
41
  }
42
 
43
+ /* NEW CHAT BUTTON - Black background, white text */
44
+ .stButton > button[kind="primary"] {
45
+ background-color: #000000 !important;
46
+ border-color: #000000 !important;
47
+ color: #ffffff !important;
48
+ }
49
+
50
+ .stButton > button[kind="primary"]:hover {
51
+ background-color: #333333 !important;
52
+ border-color: #333333 !important;
53
+ color: #ffffff !important;
54
+ }
55
+
56
+ .stButton > button[kind="primary"]:active {
57
+ background-color: #1a1a1a !important;
58
+ border-color: #1a1a1a !important;
59
+ color: #ffffff !important;
60
+ }
61
+
62
+ .stButton > button[kind="primary"]:focus {
63
+ background-color: #000000 !important;
64
+ border-color: #000000 !important;
65
+ color: #ffffff !important;
66
+ box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.25) !important;
67
+ }
68
+
69
  /* Chat history styling */
70
  .chat-history-item {
71
  padding: 8px 12px;
 
358
  def get_user_id():
359
  """Get unique ID for this user session"""
360
  if 'user_id' not in st.session_state:
361
+ st.session_state.user_id = str(uuid.uuid4())[:8] # Short ID for family use
 
362
  return st.session_state.user_id
363
 
364
 
 
523
  st.title("Chat Flow πŸ•·")
524
  st.caption("10 powerful Models, one simple chat.")
525
 
526
+ # Sidebar for chat management and settings
527
  with st.sidebar:
528
+ # New Chat Button - NOW WITH BLACK STYLING
 
 
 
529
  if st.button("βž• New Chat", use_container_width=True, type="primary"):
530
  start_new_chat()
531
  st.rerun()
 
572
  st.rerun()
573
 
574
  with col_delete:
575
+ if st.button("βœ•", key=f"delete_{session_id}"):
576
  delete_session(session_id)
577
  # If deleted session was current, start new chat
578
  if session_id == current_session_id:
 
731
  st.success("Chat cleared!")
732
  st.rerun()
733
 
 
 
734
  # Display chat messages
735
  for message in st.session_state.messages:
736
  with st.chat_message(message["role"]):