dev-yuje commited on
Commit
2954d4f
ยท
1 Parent(s): 6bf34b8

style: optimize Gradio 6.x bubble chat layout and scrollbars

Browse files
Files changed (1) hide show
  1. src/utils/ui_templates.py +26 -6
src/utils/ui_templates.py CHANGED
@@ -237,7 +237,7 @@ div[data-testid="chatbot"], .chatbot-container, .chatbot {
237
  height: 100% !important;
238
  min-height: 400px !important;
239
  flex-grow: 1 !important;
240
- overflow: visible !important;
241
  margin: 0 auto !important;
242
  }
243
 
@@ -401,13 +401,18 @@ label.svelte-1ipelgc, span.svelte-1ipelgc {
401
  }
402
 
403
  /* โ”€โ”€ ๋ฉ”์‹œ์ง€ ๋ฒ„๋ธ” ๊ธฐ๋ณธ ํฌ๊ธฐ ์ถ•์†Œ (์‚ฌ์šฉ์ž/๋ด‡ ๊ณตํ†ต ์„ธ๋กœ ๋†’์ด ์ตœ์ ํ™”) โ”€โ”€ */
404
- .message {
 
 
 
405
  padding: 10px 14px !important;
406
  min-height: auto !important;
407
  }
408
 
409
  /* โ”€โ”€ ์‚ฌ์šฉ์ž ๋ฒ„๋ธ” (๋‹คํฌ๊ทธ๋ ˆ์ด ํ”„๋ฆฌ๋ฏธ์—„ ํ…Œ๋งˆ) โ”€โ”€ */
410
- .message.user {
 
 
411
  background-color: #111827 !important;
412
  border-radius: 12px 12px 0 12px !important;
413
  padding: 10px 14px !important;
@@ -416,7 +421,9 @@ label.svelte-1ipelgc, span.svelte-1ipelgc {
416
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
417
  color: #ffffff !important;
418
  }
419
- .message.user * {
 
 
420
  color: #ffffff !important;
421
  line-height: 1.4 !important;
422
  margin: 0 !important;
@@ -424,7 +431,9 @@ label.svelte-1ipelgc, span.svelte-1ipelgc {
424
  }
425
 
426
  /* โ”€โ”€ ๋ด‡ ๋ฒ„๋ธ” (ํ™”์ดํŠธ & ๊ทธ๋ ˆ์ด ๊ฒฝ๊ณ„์„  ํ…Œ๋งˆ) โ”€โ”€ */
427
- .message.bot {
 
 
428
  background-color: #ffffff !important;
429
  color: #1f2937 !important;
430
  border: 1px solid #e5e7eb !important;
@@ -432,7 +441,9 @@ label.svelte-1ipelgc, span.svelte-1ipelgc {
432
  padding: 16px 20px !important;
433
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
434
  }
435
- .message.bot * {
 
 
436
  color: #1e3a5f !important;
437
  background: transparent !important;
438
  }
@@ -516,6 +527,15 @@ button[aria-label="thumbs up"],
516
  button[aria-label="thumbs down"],
517
  .bot + div > div > button,
518
  .svelte-1ed2p3z { display: none !important; }
 
 
 
 
 
 
 
 
 
519
  """
520
 
521
 
 
237
  height: 100% !important;
238
  min-height: 400px !important;
239
  flex-grow: 1 !important;
240
+ overflow: auto !important;
241
  margin: 0 auto !important;
242
  }
243
 
 
401
  }
402
 
403
  /* โ”€โ”€ ๋ฉ”์‹œ์ง€ ๋ฒ„๋ธ” ๊ธฐ๋ณธ ํฌ๊ธฐ ์ถ•์†Œ (์‚ฌ์šฉ์ž/๋ด‡ ๊ณตํ†ต ์„ธ๋กœ ๋†’์ด ์ตœ์ ํ™”) โ”€โ”€ */
404
+ .message,
405
+ .message-wrap .message,
406
+ [data-testid="user-message"],
407
+ [data-testid="bot-message"] {
408
  padding: 10px 14px !important;
409
  min-height: auto !important;
410
  }
411
 
412
  /* โ”€โ”€ ์‚ฌ์šฉ์ž ๋ฒ„๋ธ” (๋‹คํฌ๊ทธ๋ ˆ์ด ํ”„๋ฆฌ๋ฏธ์—„ ํ…Œ๋งˆ) โ”€โ”€ */
413
+ .message.user,
414
+ .message.user-message,
415
+ [data-testid="user-message"] {
416
  background-color: #111827 !important;
417
  border-radius: 12px 12px 0 12px !important;
418
  padding: 10px 14px !important;
 
421
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
422
  color: #ffffff !important;
423
  }
424
+ .message.user *,
425
+ .message.user-message *,
426
+ [data-testid="user-message"] * {
427
  color: #ffffff !important;
428
  line-height: 1.4 !important;
429
  margin: 0 !important;
 
431
  }
432
 
433
  /* โ”€โ”€ ๋ด‡ ๋ฒ„๋ธ” (ํ™”์ดํŠธ & ๊ทธ๋ ˆ์ด ๊ฒฝ๊ณ„์„  ํ…Œ๋งˆ) โ”€โ”€ */
434
+ .message.bot,
435
+ .message.bot-message,
436
+ [data-testid="bot-message"] {
437
  background-color: #ffffff !important;
438
  color: #1f2937 !important;
439
  border: 1px solid #e5e7eb !important;
 
441
  padding: 16px 20px !important;
442
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
443
  }
444
+ .message.bot *,
445
+ .message.bot-message *,
446
+ [data-testid="bot-message"] * {
447
  color: #1e3a5f !important;
448
  background: transparent !important;
449
  }
 
527
  button[aria-label="thumbs down"],
528
  .bot + div > div > button,
529
  .svelte-1ed2p3z { display: none !important; }
530
+
531
+ /* โ”€โ”€ Gradio 6.x Chatbot ๋‚ด๋ถ€ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋ฐ ์Šคํฌ๋กค๋ฐ” ์ตœ์ ํ™” โ”€โ”€ */
532
+ div[data-testid="chatbot"] .message-wrap,
533
+ div[data-testid="chatbot"] .message-container,
534
+ div[data-testid="chatbot"] > div.wrapper,
535
+ div[data-testid="chatbot"] > div.scrollbar {
536
+ overflow-y: auto !important;
537
+ max-height: 600px !important;
538
+ }
539
  """
540
 
541