ghadgemadhuri92 commited on
Commit
a0f64e8
Β·
1 Parent(s): b356a40

Fix UI scroll layout to freeze sidebar and input tabs

Browse files
Files changed (1) hide show
  1. frontend/app.py +15 -11
frontend/app.py CHANGED
@@ -648,9 +648,12 @@ def chat_interface():
648
  st.title(active_sess["title"] if active_sess else "Chat")
649
 
650
  # ── ALWAYS render history first ────────────────────────────────────────
651
- # This runs every pass β€” so the user question is visible while processing
652
- for msg in st.session_state.messages:
653
- _render_message(msg)
 
 
 
654
 
655
  # ══════════════════════════════════════════════════════════════════════
656
  # STATE: PROCESSING
@@ -662,14 +665,15 @@ def chat_interface():
662
  request_id = str(uuid.uuid4())
663
 
664
  # Spinner appears BELOW the rendered history (user question visible above)
665
- with st.spinner("Thinking..."):
666
- result = api_solve(
667
- text = last.get("content", ""),
668
- image = last.get("image_data"),
669
- session_id = active_sid,
670
- request_id = request_id,
671
- mode = st.session_state.current_mode,
672
- )
 
673
 
674
  # Auth expired β€” logout
675
  if result.get("error") == "AUTH_EXPIRED":
 
648
  st.title(active_sess["title"] if active_sess else "Chat")
649
 
650
  # ── ALWAYS render history first ────────────────────────────────────────
651
+ # Wrap history in a fixed-height scrolling container so the page doesn't grow
652
+ # infinitely, keeping the tabs and sidebar perfectly frozen.
653
+ chat_container = st.container(height=500, border=False)
654
+ with chat_container:
655
+ for msg in st.session_state.messages:
656
+ _render_message(msg)
657
 
658
  # ══════════════════════════════════════════════════════════════════════
659
  # STATE: PROCESSING
 
665
  request_id = str(uuid.uuid4())
666
 
667
  # Spinner appears BELOW the rendered history (user question visible above)
668
+ with chat_container:
669
+ with st.spinner("Thinking..."):
670
+ result = api_solve(
671
+ text = last.get("content", ""),
672
+ image = last.get("image_data"),
673
+ session_id = active_sid,
674
+ request_id = request_id,
675
+ mode = st.session_state.current_mode,
676
+ )
677
 
678
  # Auth expired β€” logout
679
  if result.get("error") == "AUTH_EXPIRED":