Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -605,12 +605,14 @@ def generate_personalized_sms_wrapper(selected_product, description, product_nam
|
|
605 |
# Выполняем проверки sms_1
|
606 |
cut_sms_1 = cut_message(sms_1)
|
607 |
checks_1 = perform_checks(cut_sms_1, key_message, exceptions_dict)
|
608 |
-
checks_formatted_1 = format_checks(checks_1)
|
609 |
|
610 |
-
print("[DEBUG B] final
|
611 |
-
print("[DEBUG B]
|
|
|
|
|
|
|
612 |
|
613 |
-
|
614 |
|
615 |
yield(sms_1, "", final_prompt_1, "", checks_formatted_1, "")
|
616 |
|
@@ -619,6 +621,13 @@ def generate_personalized_sms_wrapper(selected_product, description, product_nam
|
|
619 |
# Выполняем проверки sms_2
|
620 |
cut_sms_2 = cut_message(sms_2)
|
621 |
checks_2 = perform_checks(cut_sms_2, key_message, exceptions_dict)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
checks_formatted_2 = format_checks(checks_2)
|
623 |
|
624 |
print("[DEBUG B] final checks_2 =>", checks_2)
|
@@ -656,6 +665,12 @@ def on_regenerate(
|
|
656 |
# Проверяем заново:
|
657 |
cut_sms_1 = cut_message(sms_1)
|
658 |
checks_1 = perform_checks(cut_sms_1, key_message, exceptions_dict)
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
checks_formatted_1 = format_checks(checks_1)
|
660 |
|
661 |
yield sms_1, "", checks_formatted_1, ""
|
@@ -664,6 +679,12 @@ def on_regenerate(
|
|
664 |
|
665 |
cut_sms_2 = cut_message(sms_2)
|
666 |
checks_2 = perform_checks(cut_sms_2, key_message, exceptions_dict)
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
checks_formatted_2 = format_checks(checks_2)
|
668 |
|
669 |
# Теперь сохраняем всё, как при «Я предпочитаю это SMS»,
|
@@ -1870,13 +1891,13 @@ def attempt_generate_sms_with_checks(model_prompt: str, product_name: str, key_m
|
|
1870 |
sms = generate_message(model_prompt, product_name)
|
1871 |
cut_sms = cut_message(sms)
|
1872 |
|
|
|
|
|
1873 |
print("[DEBUG A] attempt_generate_sms_with_checks => sms full:", repr(sms))
|
1874 |
print("[DEBUG A] attempt_generate_sms_with_checks => sms cut:", repr(cut_sms))
|
1875 |
-
# Посмотрим key_message
|
1876 |
print("[DEBUG A] attempt_generate_sms_with_checks => key_message:", repr(key_message))
|
1877 |
-
|
1878 |
-
all_critical_ok, failed_non_crit = run_checks_critical_and_non_critical(cut_sms, key_message)
|
1879 |
print("[DEBUG A] => all_critical_ok=", all_critical_ok, "failed_non_crit=", failed_non_crit)
|
|
|
1880 |
return sms, all_critical_ok, failed_non_crit
|
1881 |
|
1882 |
|
|
|
605 |
# Выполняем проверки sms_1
|
606 |
cut_sms_1 = cut_message(sms_1)
|
607 |
checks_1 = perform_checks(cut_sms_1, key_message, exceptions_dict)
|
|
|
608 |
|
609 |
+
print("[DEBUG B] final check for SMS_1")
|
610 |
+
print("[DEBUG B] text going into perform_checks:", repr(cut_sms_1))
|
611 |
+
print("[DEBUG B] key_message:", repr(key_message))
|
612 |
+
print("[DEBUG B] exceptions_dict word_repetitions:", exceptions_dict.get("word_repetitions", None))
|
613 |
+
print("[DEBUG B] checks_1 =", checks_1)
|
614 |
|
615 |
+
checks_formatted_1 = format_checks(checks_1)
|
616 |
|
617 |
yield(sms_1, "", final_prompt_1, "", checks_formatted_1, "")
|
618 |
|
|
|
621 |
# Выполняем проверки sms_2
|
622 |
cut_sms_2 = cut_message(sms_2)
|
623 |
checks_2 = perform_checks(cut_sms_2, key_message, exceptions_dict)
|
624 |
+
|
625 |
+
print("[DEBUG B] final check for SMS_2")
|
626 |
+
print("[DEBUG B] text going into perform_checks:", repr(cut_sms_2))
|
627 |
+
print("[DEBUG B] key_message:", repr(key_message))
|
628 |
+
print("[DEBUG B] exceptions_dict word_repetitions:", exceptions_dict.get("word_repetitions", None))
|
629 |
+
print("[DEBUG B] checks_2 =", checks_2)
|
630 |
+
|
631 |
checks_formatted_2 = format_checks(checks_2)
|
632 |
|
633 |
print("[DEBUG B] final checks_2 =>", checks_2)
|
|
|
665 |
# Проверяем заново:
|
666 |
cut_sms_1 = cut_message(sms_1)
|
667 |
checks_1 = perform_checks(cut_sms_1, key_message, exceptions_dict)
|
668 |
+
|
669 |
+
print("[DEBUG on_regenerate] text for sms_1 final check:", repr(cut_sms_1))
|
670 |
+
print("[DEBUG on_regenerate] key_message:", repr(key_message))
|
671 |
+
print("[DEBUG on_regenerate] exceptions_dict word_repetitions:", exceptions_dict.get("word_repetitions", None))
|
672 |
+
print("[DEBUG on_regenerate] checks_1 =", checks_1)
|
673 |
+
|
674 |
checks_formatted_1 = format_checks(checks_1)
|
675 |
|
676 |
yield sms_1, "", checks_formatted_1, ""
|
|
|
679 |
|
680 |
cut_sms_2 = cut_message(sms_2)
|
681 |
checks_2 = perform_checks(cut_sms_2, key_message, exceptions_dict)
|
682 |
+
|
683 |
+
print("[DEBUG on_regenerate] text for sms_2 final check:", repr(cut_sms_2))
|
684 |
+
print("[DEBUG on_regenerate] key_message:", repr(key_message))
|
685 |
+
print("[DEBUG on_regenerate] exceptions_dict word_repetitions:", exceptions_dict.get("word_repetitions", None))
|
686 |
+
print("[DEBUG on_regenerate] checks_2 =", checks_2)
|
687 |
+
|
688 |
checks_formatted_2 = format_checks(checks_2)
|
689 |
|
690 |
# Теперь сохраняем всё, как при «Я предпочитаю это SMS»,
|
|
|
1891 |
sms = generate_message(model_prompt, product_name)
|
1892 |
cut_sms = cut_message(sms)
|
1893 |
|
1894 |
+
all_critical_ok, failed_non_crit = run_checks_critical_and_non_critical(cut_sms, key_message)
|
1895 |
+
|
1896 |
print("[DEBUG A] attempt_generate_sms_with_checks => sms full:", repr(sms))
|
1897 |
print("[DEBUG A] attempt_generate_sms_with_checks => sms cut:", repr(cut_sms))
|
|
|
1898 |
print("[DEBUG A] attempt_generate_sms_with_checks => key_message:", repr(key_message))
|
|
|
|
|
1899 |
print("[DEBUG A] => all_critical_ok=", all_critical_ok, "failed_non_crit=", failed_non_crit)
|
1900 |
+
|
1901 |
return sms, all_critical_ok, failed_non_crit
|
1902 |
|
1903 |
|