Spaces:
Sleeping
Sleeping
Update botsignal.py
Browse files- botsignal.py +9 -2
botsignal.py
CHANGED
|
@@ -126,7 +126,8 @@ INITIAL_BACKFILL = 2
|
|
| 126 |
|
| 127 |
DEDUP_BUFFER_SIZE = int(os.environ.get("DEDUP_BUFFER_SIZE", "800"))
|
| 128 |
|
| 129 |
-
|
|
|
|
| 130 |
|
| 131 |
SUPPORT_MIN_UNIQUE = int(os.environ.get("SUPPORT_MIN_UNIQUE", "2"))
|
| 132 |
|
|
@@ -777,6 +778,7 @@ async def process_message(msg, source_chat_id: int) -> None:
|
|
| 777 |
now = datetime.now(timezone.utc)
|
| 778 |
class_label, unique_groups, is_new_group = update_and_classify(topic_key, group_key, now)
|
| 779 |
|
|
|
|
| 780 |
if role != "core":
|
| 781 |
core_u, sup_u = _unique_counts_by_role(topic_key)
|
| 782 |
if core_u < 1 and sup_u < SUPPORT_MIN_UNIQUE:
|
|
@@ -786,6 +788,11 @@ async def process_message(msg, source_chat_id: int) -> None:
|
|
| 786 |
)
|
| 787 |
return
|
| 788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
cleaned_body = filter_invite_sentences(orig_text)
|
| 790 |
if not cleaned_body.strip():
|
| 791 |
debug_log("Semua kalimat terfilter (kosong), dilewati", orig_text)
|
|
@@ -978,4 +985,4 @@ async def app_main() -> None:
|
|
| 978 |
|
| 979 |
|
| 980 |
if __name__ == "__main__":
|
| 981 |
-
asyncio.run(app_main())
|
|
|
|
| 126 |
|
| 127 |
DEDUP_BUFFER_SIZE = int(os.environ.get("DEDUP_BUFFER_SIZE", "800"))
|
| 128 |
|
| 129 |
+
# >>> Perpanjang window klasifikasi biar naik tier lebih lama <<<
|
| 130 |
+
CLASS_WINDOW_MINUTES = int(os.environ.get("CLASS_WINDOW_MINUTES", "180"))
|
| 131 |
|
| 132 |
SUPPORT_MIN_UNIQUE = int(os.environ.get("SUPPORT_MIN_UNIQUE", "2"))
|
| 133 |
|
|
|
|
| 778 |
now = datetime.now(timezone.utc)
|
| 779 |
class_label, unique_groups, is_new_group = update_and_classify(topic_key, group_key, now)
|
| 780 |
|
| 781 |
+
# --- Rule lama: tahan support bila belum ada core & support unik belum cukup
|
| 782 |
if role != "core":
|
| 783 |
core_u, sup_u = _unique_counts_by_role(topic_key)
|
| 784 |
if core_u < 1 and sup_u < SUPPORT_MIN_UNIQUE:
|
|
|
|
| 788 |
)
|
| 789 |
return
|
| 790 |
|
| 791 |
+
# --- RULE BARU: Support HANYA boleh bila tier >= Medium (blok Low dari support)
|
| 792 |
+
if role == "support" and TIER_ORDER.get(class_label, 0) < TIER_ORDER["Medium ⚡"]:
|
| 793 |
+
debug_log("Support Low diblok (minimal Medium)", orig_text)
|
| 794 |
+
return
|
| 795 |
+
|
| 796 |
cleaned_body = filter_invite_sentences(orig_text)
|
| 797 |
if not cleaned_body.strip():
|
| 798 |
debug_log("Semua kalimat terfilter (kosong), dilewati", orig_text)
|
|
|
|
| 985 |
|
| 986 |
|
| 987 |
if __name__ == "__main__":
|
| 988 |
+
asyncio.run(app_main())
|