|
8 | 8 | from batch.utilities.helpers.config.config_helper import ConfigHelper |
9 | 9 | from azure.core.exceptions import ResourceNotFoundError |
10 | 10 | from batch.utilities.helpers.config.assistant_strategy import AssistantStrategy |
| 11 | + |
11 | 12 | sys.path.append(os.path.join(os.path.dirname(__file__), "..")) |
12 | 13 | env_helper: EnvHelper = EnvHelper() |
13 | 14 |
|
@@ -95,10 +96,14 @@ def validate_answering_user_prompt(): |
95 | 96 | def config_legal_assistant_prompt(): |
96 | 97 | if st.session_state["ai_assistant_type"] == AssistantStrategy.LEGAL_ASSISTANT.value: |
97 | 98 | st.success("Legal Assistant Prompt") |
98 | | - st.session_state["answering_user_prompt"] = ConfigHelper.get_default_legal_assistant() |
| 99 | + st.session_state["answering_user_prompt"] = ( |
| 100 | + ConfigHelper.get_default_legal_assistant() |
| 101 | + ) |
99 | 102 | else: |
100 | 103 | st.success("Default Assistant Prompt") |
101 | | - st.session_state["answering_user_prompt"] = ConfigHelper.get_default_assistant_prompt() |
| 104 | + st.session_state["answering_user_prompt"] = ( |
| 105 | + ConfigHelper.get_default_assistant_prompt() |
| 106 | + ) |
102 | 107 |
|
103 | 108 |
|
104 | 109 | def validate_post_answering_prompt(): |
@@ -374,7 +379,7 @@ def validate_documents(): |
374 | 379 | "enable_post_answering_prompt" |
375 | 380 | ], |
376 | 381 | "enable_content_safety": st.session_state["enable_content_safety"], |
377 | | - "ai_assistant_type": st.session_state["ai_assistant_type"] |
| 382 | + "ai_assistant_type": st.session_state["ai_assistant_type"], |
378 | 383 | }, |
379 | 384 | "messages": { |
380 | 385 | "post_answering_filter": st.session_state[ |
@@ -404,9 +409,16 @@ def validate_documents(): |
404 | 409 | ) |
405 | 410 |
|
406 | 411 | with st.popover(":red[Reset configuration to defaults]"): |
| 412 | + |
| 413 | + # Close button with a custom class |
| 414 | + if st.button("X", key="close_popup", help="Close popup"): |
| 415 | + st.session_state["popup_open"] = False |
| 416 | + st.rerun() |
| 417 | + |
407 | 418 | st.write( |
408 | 419 | "**Resetting the configuration cannot be reversed, proceed with caution!**" |
409 | 420 | ) |
| 421 | + |
410 | 422 | st.text_input('Enter "reset" to proceed', key="reset_configuration") |
411 | 423 | if st.button( |
412 | 424 | ":red[Reset]", disabled=st.session_state["reset_configuration"] != "reset" |
|
0 commit comments