toxic-debug9

This commit is contained in:
2024-09-26 20:49:31 +03:00
parent 5c4c7d8a85
commit d5a9b2c840

View File

@@ -42,11 +42,11 @@ async def messages_routing(msg, state):
msg_toxic_key = f"toxic:{cid}:{uid}:{scoring_msg_id}" msg_toxic_key = f"toxic:{cid}:{uid}:{scoring_msg_id}"
logger.debug('msg_toxic_key: ', msg_toxic_key) logger.debug('msg_toxic_key: ', msg_toxic_key)
one_score = await redis.get(msg_toxic_key) one_score = await redis.get(msg_toxic_key)
msg_score = int(one_score[0]) if one_score:
logger.debug('one_score: ', msg_score) msg_score = int(one_score[0])
emoji = '😳' if toxic_score > 90 else '😟' if toxic_score > 80 else '😏' if toxic_score > 60 else '🙂' if toxic_score > 20 else '😇' logger.debug('one_score: ', msg_score)
text = f"{msg_score}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}" emoji = '😳' if toxic_score > 90 else '😟' if toxic_score > 80 else '😏' if toxic_score > 60 else '🙂' if toxic_score > 20 else '😇'
if text: text = f"{msg_score}% токсичности\nСредняя токсичность сообщений: {toxic_score}% {emoji}"
await telegram_api( await telegram_api(
"sendMessage", "sendMessage",
chat_id=cid, chat_id=cid,