Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1600,101 +1600,103 @@ elif st.session_state.view_mode == "generator":
|
|
| 1600 |
if is_editing_var:
|
| 1601 |
st.session_state.editing_variable_info = None
|
| 1602 |
st.rerun()
|
| 1603 |
-
|
| 1604 |
-
|
| 1605 |
-
|
| 1606 |
-
|
| 1607 |
-
|
| 1608 |
-
|
| 1609 |
-
|
| 1610 |
-
|
| 1611 |
-
|
| 1612 |
-
|
| 1613 |
-
|
| 1614 |
-
|
| 1615 |
-
|
| 1616 |
-
|
| 1617 |
-
|
| 1618 |
-
|
| 1619 |
-
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
|
| 1627 |
-
|
| 1628 |
-
|
| 1629 |
-
|
| 1630 |
-
|
| 1631 |
-
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
-
|
| 1635 |
-
|
| 1636 |
-
|
| 1637 |
-
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
| 1641 |
-
|
| 1642 |
-
|
| 1643 |
-
|
| 1644 |
-
|
| 1645 |
-
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
|
| 1649 |
-
|
| 1650 |
-
|
| 1651 |
-
|
| 1652 |
-
|
| 1653 |
-
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
|
| 1660 |
-
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
|
| 1664 |
-
|
| 1665 |
-
|
| 1666 |
-
|
| 1667 |
-
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
|
| 1676 |
-
|
| 1677 |
-
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
| 1686 |
-
|
| 1687 |
-
|
| 1688 |
-
|
| 1689 |
-
|
| 1690 |
-
|
| 1691 |
-
|
| 1692 |
-
|
| 1693 |
-
|
| 1694 |
-
|
| 1695 |
-
|
| 1696 |
-
|
| 1697 |
-
|
|
|
|
|
|
|
| 1698 |
|
| 1699 |
if st.session_state.get('go_to_config_section'):
|
| 1700 |
st.session_state.go_to_config_section = False
|
|
|
|
| 1600 |
if is_editing_var:
|
| 1601 |
st.session_state.editing_variable_info = None
|
| 1602 |
st.rerun()
|
| 1603 |
+
# --- TEMPORARILY COMMENTED OUT FOR GLITCH TESTING ---
|
| 1604 |
+
# st.markdown("---"); st.subheader("🏷️ Tags"); current_tags_str = ", ".join(current_prompt_config.get("tags", []))
|
| 1605 |
+
# new_tags_str_input = st.text_input("Tags (séparés par des virgules):", value=current_tags_str, key=f"tags_input_{generator_family}_{generator_use_case}")
|
| 1606 |
+
# if st.button("Sauvegarder Tags", key=f"save_tags_btn_{generator_family}_{generator_use_case}"): current_prompt_config["tags"] = sorted(list(set(t.strip() for t in new_tags_str_input.split(',') if t.strip()))); current_prompt_config["updated_at"] = datetime.now().isoformat(); save_editable_prompts_to_local_and_hf(); st.success("Tags sauvegardés!"); st.rerun()
|
| 1607 |
+
|
| 1608 |
+
# --- TEMPORARILY COMMENTED OUT FOR GLITCH TESTING ---
|
| 1609 |
+
# st.markdown("---")
|
| 1610 |
+
# st.subheader("Actions sur le Cas d'Usage")
|
| 1611 |
+
|
| 1612 |
+
# if st.session_state.duplicating_use_case_details and \
|
| 1613 |
+
# st.session_state.duplicating_use_case_details["family"] == generator_family and \
|
| 1614 |
+
# st.session_state.duplicating_use_case_details["use_case"] == generator_use_case:
|
| 1615 |
+
|
| 1616 |
+
# original_uc_name_for_dup_form = st.session_state.duplicating_use_case_details["use_case"]
|
| 1617 |
+
# original_family_name_for_dup = st.session_state.duplicating_use_case_details["family"]
|
| 1618 |
+
# st.markdown(f"#### Dupliquer '{original_uc_name_for_dup_form}' (depuis: {original_family_name_for_dup})")
|
| 1619 |
+
|
| 1620 |
+
# form_key_duplicate = f"form_duplicate_name_{original_family_name_for_dup.replace(' ','_')}_{original_uc_name_for_dup_form.replace(' ','_')}"
|
| 1621 |
+
# with st.form(key=form_key_duplicate):
|
| 1622 |
+
# available_families_list = list(st.session_state.editable_prompts.keys())
|
| 1623 |
+
# try:
|
| 1624 |
+
# default_family_idx = available_families_list.index(original_family_name_for_dup)
|
| 1625 |
+
# except ValueError:
|
| 1626 |
+
# default_family_idx = 0
|
| 1627 |
+
|
| 1628 |
+
# selected_target_family_for_duplicate = st.selectbox(
|
| 1629 |
+
# "Choisir la famille de destination pour la copie :",
|
| 1630 |
+
# options=available_families_list,
|
| 1631 |
+
# index=default_family_idx,
|
| 1632 |
+
# key=f"target_family_dup_select_{form_key_duplicate}"
|
| 1633 |
+
# )
|
| 1634 |
+
|
| 1635 |
+
# suggested_new_name_base = f"{original_uc_name_for_dup_form} (copie)"
|
| 1636 |
+
# suggested_new_name = suggested_new_name_base
|
| 1637 |
+
# temp_copy_count = 1
|
| 1638 |
+
# while suggested_new_name in st.session_state.editable_prompts.get(selected_target_family_for_duplicate, {}):
|
| 1639 |
+
# suggested_new_name = f"{suggested_new_name_base} {temp_copy_count}"
|
| 1640 |
+
# temp_copy_count += 1
|
| 1641 |
+
|
| 1642 |
+
# new_duplicated_uc_name_input = st.text_input(
|
| 1643 |
+
# "Nouveau nom pour le cas d'usage dupliqué:",
|
| 1644 |
+
# value=suggested_new_name,
|
| 1645 |
+
# key=f"new_dup_name_input_{form_key_duplicate}"
|
| 1646 |
+
# )
|
| 1647 |
+
|
| 1648 |
+
# submitted_duplicate_form = st.form_submit_button("✅ Confirmer la Duplication", use_container_width=True)
|
| 1649 |
+
|
| 1650 |
+
# if submitted_duplicate_form:
|
| 1651 |
+
# new_uc_name_val_from_form = new_duplicated_uc_name_input.strip()
|
| 1652 |
+
# target_family_on_submit = selected_target_family_for_duplicate
|
| 1653 |
+
|
| 1654 |
+
# if not new_uc_name_val_from_form:
|
| 1655 |
+
# st.error("Le nom du nouveau cas d'usage ne peut pas être vide.")
|
| 1656 |
+
# elif new_uc_name_val_from_form in st.session_state.editable_prompts.get(target_family_on_submit, {}):
|
| 1657 |
+
# st.error(f"Un cas d'usage nommé '{new_uc_name_val_from_form}' existe déjà dans la famille '{target_family_on_submit}'.")
|
| 1658 |
+
# else:
|
| 1659 |
+
# st.session_state.editable_prompts[target_family_on_submit][new_uc_name_val_from_form] = copy.deepcopy(current_prompt_config)
|
| 1660 |
+
# now_iso_dup_create, now_iso_dup_update = get_default_dates()
|
| 1661 |
+
# st.session_state.editable_prompts[target_family_on_submit][new_uc_name_val_from_form]["created_at"] = now_iso_dup_create
|
| 1662 |
+
# st.session_state.editable_prompts[target_family_on_submit][new_uc_name_val_from_form]["updated_at"] = now_iso_dup_update
|
| 1663 |
+
# st.session_state.editable_prompts[target_family_on_submit][new_uc_name_val_from_form]["usage_count"] = 0
|
| 1664 |
+
# save_editable_prompts_to_local_and_hf()
|
| 1665 |
+
# st.success(f"Cas d'usage '{original_uc_name_for_dup_form}' dupliqué en '{new_uc_name_val_from_form}' dans la famille '{target_family_on_submit}'.")
|
| 1666 |
+
|
| 1667 |
+
# st.session_state.duplicating_use_case_details = None
|
| 1668 |
+
# st.session_state.force_select_family_name = target_family_on_submit
|
| 1669 |
+
# st.session_state.force_select_use_case_name = new_uc_name_val_from_form
|
| 1670 |
+
# st.session_state.active_generated_prompt = ""
|
| 1671 |
+
# st.session_state.variable_type_to_create = None
|
| 1672 |
+
# st.session_state.editing_variable_info = None
|
| 1673 |
+
# st.session_state.go_to_config_section = True
|
| 1674 |
+
# st.rerun()
|
| 1675 |
+
|
| 1676 |
+
# cancel_key_duplicate = f"cancel_dup_process_{original_family_name_for_dup.replace(' ','_')}_{original_uc_name_for_dup_form.replace(' ','_')}"
|
| 1677 |
+
# if st.button("❌ Annuler la Duplication", key=cancel_key_duplicate, use_container_width=True):
|
| 1678 |
+
# st.session_state.duplicating_use_case_details = None
|
| 1679 |
+
# st.rerun()
|
| 1680 |
+
# else:
|
| 1681 |
+
# action_cols_manage = st.columns(2)
|
| 1682 |
+
# with action_cols_manage[0]:
|
| 1683 |
+
# dup_key_init = f"initiate_dup_uc_btn_{generator_family.replace(' ','_')}_{generator_use_case.replace(' ','_')}"
|
| 1684 |
+
# if st.button("🔄 Dupliquer ce Cas d'Usage", key=dup_key_init, use_container_width=True):
|
| 1685 |
+
# st.session_state.duplicating_use_case_details = {
|
| 1686 |
+
# "family": generator_family,
|
| 1687 |
+
# "use_case": generator_use_case
|
| 1688 |
+
# }
|
| 1689 |
+
# st.session_state.go_to_config_section = True
|
| 1690 |
+
# st.rerun()
|
| 1691 |
+
|
| 1692 |
+
# with action_cols_manage[1]:
|
| 1693 |
+
# del_uc_key_exp_main = f"del_uc_btn_exp_main_{generator_family.replace(' ','_')}_{generator_use_case.replace(' ','_')}"
|
| 1694 |
+
# is_confirming_this_uc_delete_main = bool(st.session_state.confirming_delete_details and \
|
| 1695 |
+
# st.session_state.confirming_delete_details.get("family") == generator_family and \
|
| 1696 |
+
# st.session_state.confirming_delete_details.get("use_case") == generator_use_case)
|
| 1697 |
+
# if st.button("🗑️ Supprimer Cas d'Usage", key=del_uc_key_exp_main, type="secondary", disabled=is_confirming_this_uc_delete_main, use_container_width=True):
|
| 1698 |
+
# st.session_state.confirming_delete_details = {"family": generator_family, "use_case": generator_use_case}
|
| 1699 |
+
# st.rerun()
|
| 1700 |
|
| 1701 |
if st.session_state.get('go_to_config_section'):
|
| 1702 |
st.session_state.go_to_config_section = False
|