Spaces:
Sleeping
Sleeping
XQ commited on
Commit ·
75d5d3a
1
Parent(s): ec71d28
Update UI
Browse files- src/ui/app.py +2 -9
src/ui/app.py
CHANGED
|
@@ -417,16 +417,13 @@ st.markdown(
|
|
| 417 |
# ---------------------------------------------------------------------------
|
| 418 |
# Search form
|
| 419 |
# ---------------------------------------------------------------------------
|
| 420 |
-
if "example_question" not in st.session_state:
|
| 421 |
-
st.session_state.example_question = ""
|
| 422 |
-
|
| 423 |
def _pick_example() -> None:
|
| 424 |
"""Select a random example question and store it in session state."""
|
| 425 |
-
st.session_state.
|
| 426 |
|
| 427 |
question = st.text_input(
|
| 428 |
t["search_label"],
|
| 429 |
-
|
| 430 |
placeholder=t["search_placeholder"],
|
| 431 |
)
|
| 432 |
|
|
@@ -436,10 +433,6 @@ with col_search:
|
|
| 436 |
with col_example:
|
| 437 |
st.button(t["example_button"], on_click=_pick_example, use_container_width=True)
|
| 438 |
|
| 439 |
-
# Clear the stored example so it doesn't persist across manual edits
|
| 440 |
-
if st.session_state.example_question:
|
| 441 |
-
st.session_state.example_question = ""
|
| 442 |
-
|
| 443 |
# ---------------------------------------------------------------------------
|
| 444 |
# Query logic
|
| 445 |
# ---------------------------------------------------------------------------
|
|
|
|
| 417 |
# ---------------------------------------------------------------------------
|
| 418 |
# Search form
|
| 419 |
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
| 420 |
def _pick_example() -> None:
|
| 421 |
"""Select a random example question and store it in session state."""
|
| 422 |
+
st.session_state.query_input = random.choice(EXAMPLE_QUESTIONS)
|
| 423 |
|
| 424 |
question = st.text_input(
|
| 425 |
t["search_label"],
|
| 426 |
+
key="query_input",
|
| 427 |
placeholder=t["search_placeholder"],
|
| 428 |
)
|
| 429 |
|
|
|
|
| 433 |
with col_example:
|
| 434 |
st.button(t["example_button"], on_click=_pick_example, use_container_width=True)
|
| 435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
# ---------------------------------------------------------------------------
|
| 437 |
# Query logic
|
| 438 |
# ---------------------------------------------------------------------------
|