cutterdalton-webai commited on
Commit
a8810ae
·
verified ·
1 Parent(s): 5f6acdd

fix: let the demo page scroll past the viewport

Browse files

The chat shell was locked to 100vh with overflow hidden, so Parameters, the disclaimer, and the Showcase tab were clipped.

Files changed (1) hide show
  1. app.py +45 -22
app.py CHANGED
@@ -188,14 +188,24 @@ html, body, #root, .gradio-container, .gradio-container > .main,
188
  .gradio-container .wrap.default {
189
  background: transparent !important;
190
  }
191
- html, body, .gradio-container, .gradio-container > .main, .fillable,
 
 
 
 
 
 
 
 
 
 
192
  .contain, .app {
193
- height: 100% !important;
194
  min-height: 100vh !important;
195
- max-height: 100vh !important;
196
  max-width: none !important;
197
  margin: 0 !important;
198
- overflow: hidden !important;
199
  }
200
  .gradio-container, .main.fillable, .contain {
201
  display: flex !important;
@@ -213,14 +223,14 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
213
 
214
  #app-shell {
215
  flex: 1 1 auto !important;
216
- height: 100% !important;
217
- max-height: 100% !important;
218
- min-height: 0 !important;
219
  display: flex !important;
220
  flex-direction: column !important;
221
- padding: 16px 24px 12px !important;
222
  box-sizing: border-box !important;
223
- overflow: hidden !important;
224
  background: var(--weba-canvas) !important;
225
  }
226
  #app-shell > .gap, #app-shell > div {
@@ -322,25 +332,30 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
322
  #twil-chat {
323
  max-width: 768px !important;
324
  width: 100% !important;
325
- height: 100% !important;
 
326
  margin: 0 auto !important;
327
  flex: 1 1 auto !important;
328
  display: flex !important;
329
  flex-direction: column !important;
330
- overflow: hidden !important;
331
  }
332
  #twil-chat > .wrapper {
333
  flex: 1 1 auto !important;
334
- height: 100% !important;
 
335
  min-height: 0 !important;
336
  display: flex !important;
337
  flex-direction: column !important;
338
- overflow: hidden !important;
339
  }
340
  #twil-chat .bubble-wrap {
341
  flex: 1 1 auto !important;
342
- height: 100% !important;
343
- min-height: 0 !important;
 
 
 
344
  overflow-x: hidden !important;
345
  overflow-y: auto !important;
346
  overscroll-behavior: contain;
@@ -544,12 +559,15 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
544
  flex-shrink: 0;
545
  }
546
 
547
- /* Tabs shell: keep the chat layout filling the viewport */
548
  #twil-tabs {
549
  flex: 1 1 auto !important;
550
  min-height: 0 !important;
 
 
551
  display: flex !important;
552
  flex-direction: column !important;
 
553
  background: transparent !important;
554
  border: none !important;
555
  box-shadow: none !important;
@@ -581,8 +599,10 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
581
  }
582
  #twil-tabs .tabitem {
583
  flex: 1 1 auto !important;
584
- min-height: 0 !important;
585
- overflow: hidden !important;
 
 
586
  background: transparent !important;
587
  border: none !important;
588
  box-shadow: none !important;
@@ -590,8 +610,10 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
590
  }
591
  #tab-chat > .gap, #tab-chat > .column,
592
  #tab-chat, #tab-chat .column:has(> div > #twil-chat) {
593
- height: 100% !important;
 
594
  min-height: 0 !important;
 
595
  }
596
  #tab-chat > .gap, #tab-chat > .column {
597
  display: flex !important;
@@ -604,7 +626,9 @@ footer, .footer, .built-with, .settings, .settings-bar, .show-api,
604
  height: auto !important;
605
  }
606
  #tab-showcase {
607
- overflow-y: auto !important;
 
 
608
  }
609
 
610
  /* Showcase cards */
@@ -949,7 +973,7 @@ def generate_reply(history, max_new_tokens, temperature, top_p, enable_thinking)
949
  yield history
950
 
951
 
952
- with gr.Blocks(fill_height=True, fill_width=True, elem_id="app-root") as demo:
953
  with gr.Column(elem_id="app-shell"):
954
  gr.HTML(HEADER)
955
  with gr.Tabs(elem_id="twil-tabs") as tabs:
@@ -968,7 +992,6 @@ with gr.Blocks(fill_height=True, fill_width=True, elem_id="app-root") as demo:
968
  line_breaks=False,
969
  elem_id="twil-chat",
970
  scale=1,
971
- height="100%",
972
  autoscroll=True,
973
  )
974
  with gr.Row(elem_id="chips-row") as chips_row:
 
188
  .gradio-container .wrap.default {
189
  background: transparent !important;
190
  }
191
+ /* The page itself scrolls. Inner panes must not cap the document at 100vh. */
192
+ html, body {
193
+ height: auto !important;
194
+ min-height: 100% !important;
195
+ max-height: none !important;
196
+ max-width: none !important;
197
+ margin: 0 !important;
198
+ overflow-x: hidden !important;
199
+ overflow-y: auto !important;
200
+ }
201
+ .gradio-container, .gradio-container > .main, .fillable,
202
  .contain, .app {
203
+ height: auto !important;
204
  min-height: 100vh !important;
205
+ max-height: none !important;
206
  max-width: none !important;
207
  margin: 0 !important;
208
+ overflow: visible !important;
209
  }
210
  .gradio-container, .main.fillable, .contain {
211
  display: flex !important;
 
223
 
224
  #app-shell {
225
  flex: 1 1 auto !important;
226
+ height: auto !important;
227
+ max-height: none !important;
228
+ min-height: 100vh !important;
229
  display: flex !important;
230
  flex-direction: column !important;
231
+ padding: 16px 24px 24px !important;
232
  box-sizing: border-box !important;
233
+ overflow: visible !important;
234
  background: var(--weba-canvas) !important;
235
  }
236
  #app-shell > .gap, #app-shell > div {
 
332
  #twil-chat {
333
  max-width: 768px !important;
334
  width: 100% !important;
335
+ height: auto !important;
336
+ max-height: none !important;
337
  margin: 0 auto !important;
338
  flex: 1 1 auto !important;
339
  display: flex !important;
340
  flex-direction: column !important;
341
+ overflow: visible !important;
342
  }
343
  #twil-chat > .wrapper {
344
  flex: 1 1 auto !important;
345
+ height: auto !important;
346
+ max-height: none !important;
347
  min-height: 0 !important;
348
  display: flex !important;
349
  flex-direction: column !important;
350
+ overflow: visible !important;
351
  }
352
  #twil-chat .bubble-wrap {
353
  flex: 1 1 auto !important;
354
+ height: auto !important;
355
+ min-height: 220px !important;
356
+ /* Keep a long transcript in its own scroller; the page still scrolls
357
+ to reach the composer, parameters, and disclaimer below it. */
358
+ max-height: calc(100vh - 340px) !important;
359
  overflow-x: hidden !important;
360
  overflow-y: auto !important;
361
  overscroll-behavior: contain;
 
559
  flex-shrink: 0;
560
  }
561
 
562
+ /* Tabs grow with their content so the document can scroll. */
563
  #twil-tabs {
564
  flex: 1 1 auto !important;
565
  min-height: 0 !important;
566
+ height: auto !important;
567
+ max-height: none !important;
568
  display: flex !important;
569
  flex-direction: column !important;
570
+ overflow: visible !important;
571
  background: transparent !important;
572
  border: none !important;
573
  box-shadow: none !important;
 
599
  }
600
  #twil-tabs .tabitem {
601
  flex: 1 1 auto !important;
602
+ min-height: auto !important;
603
+ height: auto !important;
604
+ max-height: none !important;
605
+ overflow: visible !important;
606
  background: transparent !important;
607
  border: none !important;
608
  box-shadow: none !important;
 
610
  }
611
  #tab-chat > .gap, #tab-chat > .column,
612
  #tab-chat, #tab-chat .column:has(> div > #twil-chat) {
613
+ height: auto !important;
614
+ max-height: none !important;
615
  min-height: 0 !important;
616
+ overflow: visible !important;
617
  }
618
  #tab-chat > .gap, #tab-chat > .column {
619
  display: flex !important;
 
626
  height: auto !important;
627
  }
628
  #tab-showcase {
629
+ overflow: visible !important;
630
+ height: auto !important;
631
+ max-height: none !important;
632
  }
633
 
634
  /* Showcase cards */
 
973
  yield history
974
 
975
 
976
+ with gr.Blocks(fill_height=False, fill_width=True, elem_id="app-root") as demo:
977
  with gr.Column(elem_id="app-shell"):
978
  gr.HTML(HEADER)
979
  with gr.Tabs(elem_id="twil-tabs") as tabs:
 
992
  line_breaks=False,
993
  elem_id="twil-chat",
994
  scale=1,
 
995
  autoscroll=True,
996
  )
997
  with gr.Row(elem_id="chips-row") as chips_row: