poemsforaphrodite
commited on
Commit
•
bd51308
1
Parent(s):
2a98cf8
Update app.py
Browse files
app.py
CHANGED
@@ -277,7 +277,7 @@ if page == "Home":
|
|
277 |
colored_header("Chat", description="Ask questions about building regulations")
|
278 |
|
279 |
# Chat container with custom CSS class
|
280 |
-
st.markdown('<div class="chat-container">', unsafe_allow_html=True)
|
281 |
for chat in st.session_state.chat_history:
|
282 |
with st.container():
|
283 |
if chat['role'] == 'user':
|
@@ -296,6 +296,16 @@ if page == "Home":
|
|
296 |
""", unsafe_allow_html=True)
|
297 |
st.markdown('</div>', unsafe_allow_html=True)
|
298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
# Chat input improvements
|
300 |
with st.form("chat_form", clear_on_submit=True):
|
301 |
user_input = st.text_area("Ask a question about building regulations...", height=100)
|
|
|
277 |
colored_header("Chat", description="Ask questions about building regulations")
|
278 |
|
279 |
# Chat container with custom CSS class
|
280 |
+
st.markdown('<div class="chat-container" id="chat-container">', unsafe_allow_html=True)
|
281 |
for chat in st.session_state.chat_history:
|
282 |
with st.container():
|
283 |
if chat['role'] == 'user':
|
|
|
296 |
""", unsafe_allow_html=True)
|
297 |
st.markdown('</div>', unsafe_allow_html=True)
|
298 |
|
299 |
+
# Inject JavaScript to auto-scroll the chat container
|
300 |
+
st.markdown("""
|
301 |
+
<script>
|
302 |
+
const chatContainer = document.getElementById('chat-container');
|
303 |
+
if (chatContainer) {
|
304 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
305 |
+
}
|
306 |
+
</script>
|
307 |
+
""", unsafe_allow_html=True)
|
308 |
+
|
309 |
# Chat input improvements
|
310 |
with st.form("chat_form", clear_on_submit=True):
|
311 |
user_input = st.text_area("Ask a question about building regulations...", height=100)
|