Polish UI with compact design and better UX
Browse filesInterface improvements:
- Add clear label for AI model dropdown
- Compact quick queries with smaller text and truncation
- Reduce header vertical space with smaller logo and fonts
- Hide image filename text when displaying charts
- Improve sidebar button styling with custom CSS
UX enhancements:
- Reduce UI jumping by limiting auto-scroll to processing only
- Better spacing throughout with reduced margins
- Cleaner visual hierarchy with appropriate font sizes
- More professional and academic appearance
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
app.py
CHANGED
@@ -201,6 +201,23 @@ st.markdown("""
|
|
201 |
background-color: #0b5ed7;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
/* Code container styling */
|
205 |
.code-container {
|
206 |
margin: 1rem 0;
|
@@ -469,16 +486,17 @@ header_col1, header_col2 = st.columns([2, 1])
|
|
469 |
|
470 |
with header_col1:
|
471 |
st.markdown("""
|
472 |
-
<div style='display: flex; align-items: center; gap: 0.75rem; margin-bottom:
|
473 |
-
<div style='width:
|
474 |
<div>
|
475 |
-
<h1 style='margin: 0; font-size: 1.
|
476 |
-
<p style='margin: 0; font-size: 0.
|
477 |
</div>
|
478 |
</div>
|
479 |
""", unsafe_allow_html=True)
|
480 |
|
481 |
with header_col2:
|
|
|
482 |
model_name = st.selectbox(
|
483 |
"Model:",
|
484 |
available_models,
|
@@ -487,7 +505,7 @@ with header_col2:
|
|
487 |
label_visibility="collapsed"
|
488 |
)
|
489 |
|
490 |
-
st.markdown("<hr style='margin:
|
491 |
|
492 |
|
493 |
# Load data with error handling
|
@@ -528,15 +546,14 @@ with st.sidebar:
|
|
528 |
"Plot monthly average PM2.5 for 2023"
|
529 |
]
|
530 |
|
531 |
-
# Quick query buttons in sidebar
|
532 |
selected_prompt = None
|
533 |
for i, question in enumerate(questions[:6]): # Show only first 6
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
):
|
540 |
selected_prompt = question
|
541 |
|
542 |
st.markdown("---")
|
@@ -606,15 +623,19 @@ def show_custom_response(response):
|
|
606 |
</div>
|
607 |
""", unsafe_allow_html=True)
|
608 |
elif role == "assistant":
|
|
|
|
|
|
|
609 |
# Assistant message with left alignment - reduced margins
|
610 |
-
|
611 |
-
|
612 |
-
<div
|
613 |
-
<div class='assistant-
|
614 |
-
|
|
|
|
|
615 |
</div>
|
616 |
-
|
617 |
-
""", unsafe_allow_html=True)
|
618 |
|
619 |
# Show generated code with Streamlit expander
|
620 |
if response.get("gen_code"):
|
@@ -792,8 +813,8 @@ if st.session_state.get("processing"):
|
|
792 |
|
793 |
st.rerun()
|
794 |
|
795 |
-
#
|
796 |
-
if st.session_state.
|
797 |
st.markdown("<script>scrollToBottom();</script>", unsafe_allow_html=True)
|
798 |
|
799 |
# Beautiful sidebar footer
|
|
|
201 |
background-color: #0b5ed7;
|
202 |
}
|
203 |
|
204 |
+
/* Sidebar button styling */
|
205 |
+
[data-testid="stSidebar"] .stButton > button {
|
206 |
+
background-color: #f8fafc;
|
207 |
+
color: #475569;
|
208 |
+
border: 1px solid #e2e8f0;
|
209 |
+
padding: 0.375rem 0.75rem;
|
210 |
+
font-size: 0.75rem;
|
211 |
+
font-weight: normal;
|
212 |
+
text-align: left;
|
213 |
+
}
|
214 |
+
|
215 |
+
[data-testid="stSidebar"] .stButton > button:hover {
|
216 |
+
background-color: #e0f2fe;
|
217 |
+
border-color: #0ea5e9;
|
218 |
+
color: #0c4a6e;
|
219 |
+
}
|
220 |
+
|
221 |
/* Code container styling */
|
222 |
.code-container {
|
223 |
margin: 1rem 0;
|
|
|
486 |
|
487 |
with header_col1:
|
488 |
st.markdown("""
|
489 |
+
<div style='display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem;'>
|
490 |
+
<div style='width: 28px; height: 28px; background: #3b82f6; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 0.875rem;'>V</div>
|
491 |
<div>
|
492 |
+
<h1 style='margin: 0; font-size: 1.125rem; font-weight: 600; color: #1e293b;'>VayuChat</h1>
|
493 |
+
<p style='margin: 0; font-size: 0.75rem; color: #64748b;'>Environmental Data Analysis</p>
|
494 |
</div>
|
495 |
</div>
|
496 |
""", unsafe_allow_html=True)
|
497 |
|
498 |
with header_col2:
|
499 |
+
st.markdown("<p style='margin: 0 0 0.25rem 0; font-size: 0.75rem; color: #6b7280;'>AI Model:</p>", unsafe_allow_html=True)
|
500 |
model_name = st.selectbox(
|
501 |
"Model:",
|
502 |
available_models,
|
|
|
505 |
label_visibility="collapsed"
|
506 |
)
|
507 |
|
508 |
+
st.markdown("<hr style='margin: 0.5rem 0; border: none; border-top: 1px solid #e2e8f0;'>", unsafe_allow_html=True)
|
509 |
|
510 |
|
511 |
# Load data with error handling
|
|
|
546 |
"Plot monthly average PM2.5 for 2023"
|
547 |
]
|
548 |
|
549 |
+
# Quick query buttons in sidebar - compact style
|
550 |
selected_prompt = None
|
551 |
for i, question in enumerate(questions[:6]): # Show only first 6
|
552 |
+
# Truncate long questions for display
|
553 |
+
display_text = question[:35] + "..." if len(question) > 35 else question
|
554 |
+
|
555 |
+
# Use columns to make buttons more compact
|
556 |
+
if st.button(display_text, key=f"sidebar_prompt_{i}", help=question, use_container_width=True):
|
|
|
557 |
selected_prompt = question
|
558 |
|
559 |
st.markdown("---")
|
|
|
623 |
</div>
|
624 |
""", unsafe_allow_html=True)
|
625 |
elif role == "assistant":
|
626 |
+
# Check if content is an image filename - don't display the filename text
|
627 |
+
is_image_path = isinstance(content, str) and any(ext in content for ext in ['.png', '.jpg', '.jpeg'])
|
628 |
+
|
629 |
# Assistant message with left alignment - reduced margins
|
630 |
+
if not is_image_path:
|
631 |
+
st.markdown(f"""
|
632 |
+
<div style='display: flex; justify-content: flex-start; margin: 1rem 0;'>
|
633 |
+
<div class='assistant-message'>
|
634 |
+
<div class='assistant-info'>VayuChat</div>
|
635 |
+
{content if isinstance(content, str) else str(content)}
|
636 |
+
</div>
|
637 |
</div>
|
638 |
+
""", unsafe_allow_html=True)
|
|
|
639 |
|
640 |
# Show generated code with Streamlit expander
|
641 |
if response.get("gen_code"):
|
|
|
813 |
|
814 |
st.rerun()
|
815 |
|
816 |
+
# Minimal auto-scroll - only scroll when processing
|
817 |
+
if st.session_state.get("processing"):
|
818 |
st.markdown("<script>scrollToBottom();</script>", unsafe_allow_html=True)
|
819 |
|
820 |
# Beautiful sidebar footer
|