feat: Improve user feedback during legal position generation with loading message and button interactivity
Browse files- interface.py +9 -2
interface.py
CHANGED
|
@@ -988,6 +988,13 @@ def create_gradio_interface() -> gr.Blocks:
|
|
| 988 |
|
| 989 |
# generation and analysis
|
| 990 |
generate_position_button.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 991 |
fn=process_input,
|
| 992 |
inputs=[
|
| 993 |
text_input,
|
|
@@ -1008,9 +1015,9 @@ def create_gradio_interface() -> gr.Blocks:
|
|
| 1008 |
],
|
| 1009 |
outputs=[position_output, state_lp_json, session_id_state]
|
| 1010 |
).then(
|
| 1011 |
-
fn=lambda: gr.update(interactive=True),
|
| 1012 |
inputs=None,
|
| 1013 |
-
outputs=search_with_ai_button
|
| 1014 |
)
|
| 1015 |
|
| 1016 |
search_with_ai_button.click(
|
|
|
|
| 988 |
|
| 989 |
# generation and analysis
|
| 990 |
generate_position_button.click(
|
| 991 |
+
fn=lambda: (
|
| 992 |
+
gr.update(value="⏳ **Генерація правової позиції...**\n\nЗапит відправлено до AI. Зачекайте, це може зайняти кілька секунд."),
|
| 993 |
+
gr.update(interactive=False)
|
| 994 |
+
),
|
| 995 |
+
inputs=None,
|
| 996 |
+
outputs=[position_output, generate_position_button]
|
| 997 |
+
).then(
|
| 998 |
fn=process_input,
|
| 999 |
inputs=[
|
| 1000 |
text_input,
|
|
|
|
| 1015 |
],
|
| 1016 |
outputs=[position_output, state_lp_json, session_id_state]
|
| 1017 |
).then(
|
| 1018 |
+
fn=lambda: (gr.update(interactive=True), gr.update(interactive=True)),
|
| 1019 |
inputs=None,
|
| 1020 |
+
outputs=[generate_position_button, search_with_ai_button]
|
| 1021 |
)
|
| 1022 |
|
| 1023 |
search_with_ai_button.click(
|