| import streamlit as st | |
| def render_query_input(): | |
| """Render the query input section with search and clear buttons.""" | |
| st.divider() | |
| query = st.text_input( | |
| "اكتب سؤالك القانوني هنا / Ask your legal question", | |
| value=st.session_state.get("query_input", ""), | |
| placeholder="مثال: ما هي شروط صحة عقد الزواج في مدونة الأسرة؟", | |
| key="query_input", | |
| ) | |
| col_btn, col_clear = st.columns([1, 5]) | |
| with col_btn: | |
| search_clicked = st.button("🔍 بحث", type="primary", use_container_width=True) | |
| with col_clear: | |
| if st.button("🗑️ مسح", use_container_width=False): | |
| st.session_state["query_input"] = "" | |
| st.session_state.pop("last_response", None) | |
| st.rerun() | |
| return query, search_clicked |