Spaces:
Running
Running
feat: Enhance interactivity of Gradio interface and improve handling of empty response in PrecedentAnalysisWorkflow
Browse files- interface.py +4 -4
- main.py +3 -0
interface.py
CHANGED
|
@@ -1025,8 +1025,8 @@ def create_gradio_interface() -> gr.Blocks:
|
|
| 1025 |
inputs=[state_lp_json],
|
| 1026 |
outputs=[search_output, state_nodes]
|
| 1027 |
).then(
|
| 1028 |
-
fn=lambda: gr.update(interactive=
|
| 1029 |
-
inputs=
|
| 1030 |
outputs=analyze_button
|
| 1031 |
)
|
| 1032 |
|
|
@@ -1035,8 +1035,8 @@ def create_gradio_interface() -> gr.Blocks:
|
|
| 1035 |
inputs=[text_input, url_input, file_input, input_method_state, state_lp_json],
|
| 1036 |
outputs=[search_output, state_nodes, state_lp_json]
|
| 1037 |
).then(
|
| 1038 |
-
fn=lambda: gr.update(interactive=
|
| 1039 |
-
inputs=
|
| 1040 |
outputs=analyze_button
|
| 1041 |
)
|
| 1042 |
|
|
|
|
| 1025 |
inputs=[state_lp_json],
|
| 1026 |
outputs=[search_output, state_nodes]
|
| 1027 |
).then(
|
| 1028 |
+
fn=lambda nodes: gr.update(interactive=nodes is not None),
|
| 1029 |
+
inputs=[state_nodes],
|
| 1030 |
outputs=analyze_button
|
| 1031 |
)
|
| 1032 |
|
|
|
|
| 1035 |
inputs=[text_input, url_input, file_input, input_method_state, state_lp_json],
|
| 1036 |
outputs=[search_output, state_nodes, state_lp_json]
|
| 1037 |
).then(
|
| 1038 |
+
fn=lambda nodes: gr.update(interactive=nodes is not None),
|
| 1039 |
+
inputs=[state_nodes],
|
| 1040 |
outputs=analyze_button
|
| 1041 |
)
|
| 1042 |
|
main.py
CHANGED
|
@@ -638,6 +638,9 @@ class PrecedentAnalysisWorkflow(Workflow):
|
|
| 638 |
position_text = f"* [{position['source_index']}] {position['description']} "
|
| 639 |
response_lines.append(position_text)
|
| 640 |
|
|
|
|
|
|
|
|
|
|
| 641 |
response_text = "\n".join(response_lines)
|
| 642 |
return StopEvent(result=response_text)
|
| 643 |
else:
|
|
|
|
| 638 |
position_text = f"* [{position['source_index']}] {position['description']} "
|
| 639 |
response_lines.append(position_text)
|
| 640 |
|
| 641 |
+
if not response_lines:
|
| 642 |
+
return StopEvent(result="Жодної релевантної правової позиції у базі не знайдено.")
|
| 643 |
+
|
| 644 |
response_text = "\n".join(response_lines)
|
| 645 |
return StopEvent(result=response_text)
|
| 646 |
else:
|