faerazo commited on
Commit
9988334
·
verified ·
1 Parent(s): aae4f3d

Update ui.py

Browse files
Files changed (1) hide show
  1. ui.py +24 -8
ui.py CHANGED
@@ -95,16 +95,25 @@ def create_interface(agent):
95
  .header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
96
  .header p { margin: .5rem 0 0 0; color: rgba(255,255,255,0.9); font-size: .95rem; }
97
 
98
- /* Chat container - flexible height for HF Spaces */
99
  .chat-container {
100
- min-height: 400px !important;
101
- max-height: 600px !important;
102
  height: auto !important;
103
  background: var(--panel) !important;
104
  border-radius: 16px !important;
105
  border: 1px solid var(--border) !important;
106
  box-shadow: 0 2px 12px rgba(0,0,0,.35) !important;
107
  overflow-y: auto !important;
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  /* Message row alignment */
@@ -387,12 +396,18 @@ def create_interface(agent):
387
  /* Ensure proper scrolling in tabs - Critical for HF Spaces */
388
  .gradio-container .tabitem,
389
  .gradio-container [role="tabpanel"] {
390
- min-height: calc(100vh - 150px) !important;
391
  max-height: none !important;
392
  height: auto !important;
393
- overflow-y: visible !important;
394
  overflow-x: hidden !important;
395
  position: relative !important;
 
 
 
 
 
 
396
  }
397
 
398
  /* Make sure tab content can expand */
@@ -405,7 +420,7 @@ def create_interface(agent):
405
  /* Responsive */
406
  @media (max-width: 768px) {
407
  .chat-container {
408
- min-height: 300px !important;
409
  max-height: 400px !important;
410
  }
411
 
@@ -443,12 +458,13 @@ def create_interface(agent):
443
  # Main Chat Tab
444
  with gr.Tab("💬 Chat with Agent"):
445
  chatbot = gr.Chatbot(
446
- height=None,
447
  show_label=False,
448
  bubble_full_width=False,
449
  type='messages',
450
  elem_classes=["chat-container"],
451
- container=True
 
452
  )
453
 
454
  # Clear chat button
 
95
  .header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
96
  .header p { margin: .5rem 0 0 0; color: rgba(255,255,255,0.9); font-size: .95rem; }
97
 
98
+ /* Chat container - flexible height for HF Spaces with proper scrolling */
99
  .chat-container {
100
+ min-height: 300px !important;
101
+ max-height: 500px !important;
102
  height: auto !important;
103
  background: var(--panel) !important;
104
  border-radius: 16px !important;
105
  border: 1px solid var(--border) !important;
106
  box-shadow: 0 2px 12px rgba(0,0,0,.35) !important;
107
  overflow-y: auto !important;
108
+ overflow-x: hidden !important;
109
+ position: relative !important;
110
+ }
111
+
112
+ /* Ensure chat messages container scrolls properly */
113
+ .chat-container .gradio-chatbot {
114
+ height: 100% !important;
115
+ max-height: 100% !important;
116
+ overflow-y: auto !important;
117
  }
118
 
119
  /* Message row alignment */
 
396
  /* Ensure proper scrolling in tabs - Critical for HF Spaces */
397
  .gradio-container .tabitem,
398
  .gradio-container [role="tabpanel"] {
399
+ min-height: auto !important;
400
  max-height: none !important;
401
  height: auto !important;
402
+ overflow-y: auto !important;
403
  overflow-x: hidden !important;
404
  position: relative !important;
405
+ padding-bottom: 20px !important;
406
+ }
407
+
408
+ /* Specific fix for chat tab to allow internal scrolling */
409
+ .gradio-container [role="tabpanel"]:has(.chat-container) {
410
+ overflow-y: visible !important;
411
  }
412
 
413
  /* Make sure tab content can expand */
 
420
  /* Responsive */
421
  @media (max-width: 768px) {
422
  .chat-container {
423
+ min-height: 250px !important;
424
  max-height: 400px !important;
425
  }
426
 
 
458
  # Main Chat Tab
459
  with gr.Tab("💬 Chat with Agent"):
460
  chatbot = gr.Chatbot(
461
+ height=400,
462
  show_label=False,
463
  bubble_full_width=False,
464
  type='messages',
465
  elem_classes=["chat-container"],
466
+ container=True,
467
+ autoscroll=True
468
  )
469
 
470
  # Clear chat button