Spaces:
Sleeping
Sleeping
Shifting show more button at bottom
Browse files- chatbot.py +5 -5
chatbot.py
CHANGED
|
@@ -120,11 +120,6 @@ def render_chatbot(code, output, error):
|
|
| 120 |
start_idx = max(0, total_messages - st.session_state.chat_display_count)
|
| 121 |
visible_conversation = st.session_state.conversation[start_idx:]
|
| 122 |
|
| 123 |
-
if start_idx > 0:
|
| 124 |
-
if st.button("🔽 Show more"):
|
| 125 |
-
st.session_state.chat_display_count += 5
|
| 126 |
-
st.rerun()
|
| 127 |
-
|
| 128 |
# Newest first
|
| 129 |
for q, a in reversed(visible_conversation):
|
| 130 |
st.markdown(f'<div class="chat-message user-message">{escape(q)}</div>', unsafe_allow_html=True)
|
|
@@ -146,6 +141,11 @@ def render_chatbot(code, output, error):
|
|
| 146 |
formatted = format_response(a)
|
| 147 |
st.markdown(f'<div class="chat-message bot-message">{formatted}</div>', unsafe_allow_html=True)
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
# Auto-scroll (optional)
|
| 150 |
st.markdown("""
|
| 151 |
<script>
|
|
|
|
| 120 |
start_idx = max(0, total_messages - st.session_state.chat_display_count)
|
| 121 |
visible_conversation = st.session_state.conversation[start_idx:]
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
# Newest first
|
| 124 |
for q, a in reversed(visible_conversation):
|
| 125 |
st.markdown(f'<div class="chat-message user-message">{escape(q)}</div>', unsafe_allow_html=True)
|
|
|
|
| 141 |
formatted = format_response(a)
|
| 142 |
st.markdown(f'<div class="chat-message bot-message">{formatted}</div>', unsafe_allow_html=True)
|
| 143 |
|
| 144 |
+
if start_idx > 0:
|
| 145 |
+
if st.button("🔽 Show more"):
|
| 146 |
+
st.session_state.chat_display_count += 5
|
| 147 |
+
st.rerun()
|
| 148 |
+
|
| 149 |
# Auto-scroll (optional)
|
| 150 |
st.markdown("""
|
| 151 |
<script>
|