uumerrr684 commited on
Commit
96bf65d
·
verified ·
1 Parent(s): 0af6145

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -17
app.py CHANGED
@@ -11,7 +11,7 @@ st.set_page_config(
11
  initial_sidebar_state="collapsed"
12
  )
13
 
14
- # Simple styling
15
  st.markdown("""
16
  <style>
17
  .stApp {
@@ -19,9 +19,9 @@ st.markdown("""
19
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
20
  }
21
 
22
- /* Hide Streamlit stuff */
23
- #MainMenu, footer, header {visibility: hidden;}
24
- .stDeployButton {display: none;}
25
 
26
  /* Clean header */
27
  .main-title {
@@ -46,7 +46,7 @@ st.markdown("""
46
  margin: 4rem 0;
47
  }
48
 
49
- /* User messages - Right, blue */
50
  .stChatMessage[data-testid*="user"] {
51
  flex-direction: row-reverse !important;
52
  margin-left: 15% !important;
@@ -60,7 +60,7 @@ st.markdown("""
60
  margin-left: 12px !important;
61
  }
62
 
63
- /* AI messages - Left, gray */
64
  .stChatMessage[data-testid*="assistant"] {
65
  margin-right: 15% !important;
66
  }
@@ -75,26 +75,47 @@ st.markdown("""
75
  }
76
 
77
  /* Hide avatars */
78
- .stChatMessage img {display: none !important;}
79
-
80
- /* Glass input */
 
 
 
 
 
 
 
 
 
 
81
  .stChatInputContainer > div {
82
- border: 1px solid rgba(255,255,255,0.3) !important;
83
  border-radius: 24px !important;
84
- background: rgba(255,255,255,0.15) !important;
85
  backdrop-filter: blur(10px) !important;
86
- box-shadow: none !important;
87
  }
88
-
 
89
  .stChatInputContainer textarea {
90
  background: transparent !important;
91
  color: white !important;
92
  border: none !important;
93
  padding: 12px 20px !important;
 
 
94
  }
95
-
 
96
  .stChatInputContainer textarea::placeholder {
97
- color: rgba(255,255,255,0.7) !important;
 
 
 
 
 
 
 
98
  }
99
  </style>
100
  """, unsafe_allow_html=True)
@@ -146,7 +167,7 @@ def get_ai_response(messages, model="openai/gpt-3.5-turbo"):
146
  yield full_response
147
  except:
148
  continue
149
- except:
150
  yield "Sorry, something went wrong."
151
 
152
  # Header
@@ -177,7 +198,7 @@ with st.sidebar:
177
  if not st.session_state.messages:
178
  st.markdown('<div class="welcome-message">How can I help you today?</div>', unsafe_allow_html=True)
179
 
180
- # Chat messages
181
  for message in st.session_state.messages:
182
  with st.chat_message(message["role"]):
183
  st.markdown(message["content"])
 
11
  initial_sidebar_state="collapsed"
12
  )
13
 
14
+ # Enhanced styling with fixed transparent input
15
  st.markdown("""
16
  <style>
17
  .stApp {
 
19
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
20
  }
21
 
22
+ /* Hide Streamlit elements */
23
+ #MainMenu, footer, header { visibility: hidden; }
24
+ .stDeployButton { display: none; }
25
 
26
  /* Clean header */
27
  .main-title {
 
46
  margin: 4rem 0;
47
  }
48
 
49
+ /* User messages - Right aligned, blue */
50
  .stChatMessage[data-testid*="user"] {
51
  flex-direction: row-reverse !important;
52
  margin-left: 15% !important;
 
60
  margin-left: 12px !important;
61
  }
62
 
63
+ /* AI messages - Left aligned, gray */
64
  .stChatMessage[data-testid*="assistant"] {
65
  margin-right: 15% !important;
66
  }
 
75
  }
76
 
77
  /* Hide avatars */
78
+ .stChatMessage img { display: none !important; }
79
+
80
+ /* Chat Input: Full Glass Fix */
81
+ .stChatInputContainer,
82
+ .stChatInputContainer div,
83
+ .stChatInputContainer div:focus-within,
84
+ .stChatInputContainer div:hover {
85
+ background: transparent !important;
86
+ border: none !important;
87
+ box-shadow: none !important;
88
+ }
89
+
90
+ /* Outer input container styling */
91
  .stChatInputContainer > div {
92
+ border: 1px solid rgba(255, 255, 255, 0.3) !important;
93
  border-radius: 24px !important;
94
+ background: rgba(255, 255, 255, 0.15) !important;
95
  backdrop-filter: blur(10px) !important;
96
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
97
  }
98
+
99
+ /* The actual textarea */
100
  .stChatInputContainer textarea {
101
  background: transparent !important;
102
  color: white !important;
103
  border: none !important;
104
  padding: 12px 20px !important;
105
+ font-size: 16px;
106
+ resize: none;
107
  }
108
+
109
+ /* Placeholder */
110
  .stChatInputContainer textarea::placeholder {
111
+ color: rgba(255, 255, 255, 0.7) !important;
112
+ opacity: 1;
113
+ }
114
+
115
+ /* Focus state */
116
+ .stChatInputContainer textarea:focus {
117
+ outline: none !important;
118
+ box-shadow: none !important;
119
  }
120
  </style>
121
  """, unsafe_allow_html=True)
 
167
  yield full_response
168
  except:
169
  continue
170
+ except Exception as e:
171
  yield "Sorry, something went wrong."
172
 
173
  # Header
 
198
  if not st.session_state.messages:
199
  st.markdown('<div class="welcome-message">How can I help you today?</div>', unsafe_allow_html=True)
200
 
201
+ # Display chat messages
202
  for message in st.session_state.messages:
203
  with st.chat_message(message["role"]):
204
  st.markdown(message["content"])