AbhayVG commited on
Commit
33930c1
·
verified ·
1 Parent(s): f18b1e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -92
app.py CHANGED
@@ -37,6 +37,7 @@ st.set_page_config(
37
  )
38
 
39
  # Custom CSS for beautiful styling
 
40
  <style>
41
  /* Clean app background */
42
  .stApp {
@@ -48,7 +49,7 @@ st.set_page_config(
48
  /* Reduce main container padding */
49
  .main .block-container {
50
  padding-top: 0.5rem;
51
- padding-bottom: 120px !important; /* Increased for fixed chat input */
52
  max-width: 100%;
53
  }
54
 
@@ -227,60 +228,81 @@ st.set_page_config(
227
  border: 1px solid #f5c2c7;
228
  }
229
 
230
- /* FIXED CHAT INPUT STYLING */
231
- [data-testid="stChatInput"] {
232
- position: fixed !important;
233
- bottom: 0 !important;
234
- left: 0 !important;
235
- right: 0 !important;
236
- background: #ffffff !important;
237
- border-top: 1px solid #e5e7eb !important;
238
- padding: 1rem !important;
239
- z-index: 1000 !important;
240
- box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
241
- }
242
-
243
- /* Adjust for sidebar on larger screens */
244
- @media (min-width: 768px) {
245
- [data-testid="stChatInput"] {
246
- margin-left: 21rem !important;
247
- }
248
- }
249
-
250
- [data-testid="stChatInput"] > div {
251
- max-width: none !important;
252
- width: 100% !important;
253
- }
254
-
255
- [data-testid="stChatInput"] .stChatInputContainer {
256
  border-radius: 12px !important;
257
  border: 2px solid #e5e7eb !important;
258
  background: #ffffff !important;
259
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
260
- overflow: hidden !important;
 
 
 
 
 
261
  }
262
 
263
- [data-testid="stChatInput"] .stChatInputContainer:focus-within {
264
  border-color: #3b82f6 !important;
265
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
 
266
  }
267
 
268
- [data-testid="stChatInput"] textarea {
 
 
 
 
 
 
 
269
  border: none !important;
270
  background: transparent !important;
271
- padding: 0.75rem 1rem !important;
 
272
  font-size: 1rem !important;
273
  line-height: 1.5 !important;
274
  resize: none !important;
275
  outline: none !important;
276
- font-family: 'Segoe UI', sans-serif !important;
277
  }
278
 
279
- [data-testid="stChatInput"] textarea::placeholder {
 
280
  color: #9ca3af !important;
281
  font-style: normal !important;
282
  }
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  [data-testid="stChatInput"] button {
285
  background: #3b82f6 !important;
286
  color: white !important;
@@ -288,7 +310,6 @@ st.set_page_config(
288
  border-radius: 8px !important;
289
  padding: 0.5rem 1rem !important;
290
  font-weight: 600 !important;
291
- margin-left: 0.5rem !important;
292
  transition: background-color 0.2s ease !important;
293
  }
294
 
@@ -296,62 +317,11 @@ st.set_page_config(
296
  background: #2563eb !important;
297
  }
298
 
299
- /* Alternative: Inline chat input (comment out fixed version above and uncomment below) */
300
- /*
301
- [data-testid="stChatInput"] {
302
- background: #f8fafc !important;
303
- border: 1px solid #e2e8f0 !important;
304
- border-radius: 12px !important;
305
- padding: 0.75rem !important;
306
- margin: 1rem 0 !important;
307
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
308
- }
309
- */
310
-
311
- /* Button */
312
- .stButton > button {
313
- background-color: #0d6efd;
314
- color: white;
315
- border-radius: 6px;
316
- padding: 0.5rem 1.25rem;
317
- border: none;
318
- font-weight: 600;
319
- transition: background-color 0.2s ease;
320
- }
321
-
322
- .stButton > button:hover {
323
- background-color: #0b5ed7;
324
- }
325
-
326
- /* Sidebar button styling - smaller, left-aligned */
327
- [data-testid="stSidebar"] .stButton > button {
328
- background-color: #f8fafc;
329
- color: #475569;
330
- border: 1px solid #e2e8f0;
331
- padding: 0.375rem 0.75rem;
332
- font-size: 0.65rem;
333
- font-weight: normal;
334
- text-align: left;
335
- white-space: normal;
336
- height: auto;
337
- line-height: 1.2;
338
- transition: all 0.2s ease;
339
- cursor: pointer;
340
- margin-bottom: 0.25rem;
341
- width: 100%;
342
- display: flex;
343
- justify-content: flex-start;
344
- }
345
-
346
- [data-testid="stSidebar"] .stButton > button:hover {
347
- background-color: #e0f2fe;
348
- border-color: #0ea5e9;
349
- color: #0c4a6e;
350
- }
351
-
352
- [data-testid="stSidebar"] .stButton > button:active {
353
- transform: translateY(0);
354
- box-shadow: none;
355
  }
356
 
357
  /* Code container styling */
 
37
  )
38
 
39
  # Custom CSS for beautiful styling
40
+ st.markdown("""
41
  <style>
42
  /* Clean app background */
43
  .stApp {
 
49
  /* Reduce main container padding */
50
  .main .block-container {
51
  padding-top: 0.5rem;
52
+ padding-bottom: 3rem;
53
  max-width: 100%;
54
  }
55
 
 
228
  border: 1px solid #f5c2c7;
229
  }
230
 
231
+ /* Chat input styling - Fixed alignment */
232
+ .stChatInput {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  border-radius: 12px !important;
234
  border: 2px solid #e5e7eb !important;
235
  background: #ffffff !important;
236
+ padding: 0.75rem 1rem !important;
237
+ font-size: 1rem !important;
238
+ width: 100% !important;
239
+ max-width: none !important;
240
+ margin: 0 !important;
241
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
242
+ transition: all 0.2s ease !important;
243
  }
244
 
245
+ .stChatInput:focus {
246
  border-color: #3b82f6 !important;
247
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
248
+ outline: none !important;
249
  }
250
 
251
+ /* Chat input container */
252
+ .stChatInput > div {
253
+ padding: 0 !important;
254
+ margin: 0 !important;
255
+ }
256
+
257
+ /* Chat input text area */
258
+ .stChatInput textarea {
259
  border: none !important;
260
  background: transparent !important;
261
+ padding: 0 !important;
262
+ margin: 0 !important;
263
  font-size: 1rem !important;
264
  line-height: 1.5 !important;
265
  resize: none !important;
266
  outline: none !important;
 
267
  }
268
 
269
+ /* Chat input placeholder */
270
+ .stChatInput textarea::placeholder {
271
  color: #9ca3af !important;
272
  font-style: normal !important;
273
  }
274
 
275
+ /* Fix the main chat input container alignment */
276
+ [data-testid="stChatInput"] {
277
+ position: fixed !important;
278
+ bottom: 0 !important;
279
+ left: 0 !important;
280
+ right: 0 !important;
281
+ background: #ffffff !important;
282
+ border-top: 1px solid #e5e7eb !important;
283
+ padding: 1rem !important;
284
+ z-index: 1000 !important;
285
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
286
+ }
287
+
288
+ /* Adjust main content to account for fixed chat input */
289
+ .main .block-container {
290
+ padding-bottom: 100px !important;
291
+ }
292
+
293
+ # /* Alternative: If you prefer inline chat input (not fixed) */
294
+ # /*
295
+ # [data-testid="stChatInput"] {
296
+ # background: #f8fafc !important;
297
+ # border: 1px solid #e2e8f0 !important;
298
+ # border-radius: 12px !important;
299
+ # padding: 0.75rem !important;
300
+ # margin: 1rem 0 !important;
301
+ # box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
302
+ # }
303
+ # */
304
+
305
+ /* Chat input button styling */
306
  [data-testid="stChatInput"] button {
307
  background: #3b82f6 !important;
308
  color: white !important;
 
310
  border-radius: 8px !important;
311
  padding: 0.5rem 1rem !important;
312
  font-weight: 600 !important;
 
313
  transition: background-color 0.2s ease !important;
314
  }
315
 
 
317
  background: #2563eb !important;
318
  }
319
 
320
+ /* Ensure proper spacing from sidebar */
321
+ @media (min-width: 768px) {
322
+ [data-testid="stChatInput"] {
323
+ margin-left: 21rem !important; /* Account for sidebar width */
324
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  }
326
 
327
  /* Code container styling */