File size: 850 Bytes
d52c55e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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 |