stability-patch

This commit is contained in:
Untone 2024-09-27 13:26:38 +03:00
parent 6d4df35f52
commit d156c10855

View File

@ -49,10 +49,12 @@ async def messages_routing(msg, state):
reply_to_msg_id = reply_msg.get("message_id")
if not reply_to_msg_id and latest_toxic_message_id:
reply_to_msg_id = int(latest_toxic_message_id)
try:
# count average between all of messages
toxic_pattern = f"toxic:{cid}:{uid}:*"
toxic_score = await get_average_pattern(toxic_pattern)
except:
pass
# current mesasage toxicity
if reply_to_msg_id:
@ -70,7 +72,9 @@ async def messages_routing(msg, state):
if toxic_score > 20
else "😇"
)
text = f"{int(one_score)}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}"
text = f"{int(one_score)}% токсичности\n"
if toxic_score:
text += "Средняя токсичность сообщений: {toxic_score}% {emoji}"
await telegram_api(
"sendMessage",
chat_id=cid,