"""UI helper components for the Streamlit app.""" import streamlit as st EXAMPLE_QUERIES = [ "How does the CNN-LSTM sliding window correct misclassifications?", "What are the four condition classes in the DAS railroad dataset?", "How does SMOTE handle class imbalance in the training data?", "What is the difference between GRU and LSTM for DAS signal processing?", "How does the HMM-RL pipeline optimize WAAM manufacturing?", "What features are extracted from DAS signals for model training?", "What is the ROC AUC score for each condition class?", "How does distributed acoustic sensing work on railroad tracks?", ] def render_example_queries(): """Render clickable example query buttons.""" cols = st.columns(2) for i, q in enumerate(EXAMPLE_QUERIES[:6]): with cols[i % 2]: if st.button(f"💬 {q[:55]}...", key=f"ex_{i}", use_container_width=True): st.session_state["prefill_query"] = q def render_sources(sources: list[dict]): """Render source cards below an answer.""" if not sources: return with st.expander(f"📚 {len(sources)} source(s) retrieved", expanded=False): for i, src in enumerate(sources): score_pct = int(src.get("score", 0) * 100) st.markdown(f"""
{src.get('text', '')[:300]}...