This commit is contained in:
Untone 2024-02-12 16:12:19 +03:00
parent 7fd358931a
commit c86061be58

View File

@ -3,6 +3,7 @@ from bot.config import FEEDBACK_CHAT_ID
from nlp.toxicity import text2toxicity
from nlp.replying import get_toxic_reply
import logging
import math
from handlers.handle_private import handle_private
logger = logging.getLogger(__name__)
@ -31,6 +32,7 @@ async def messages_routing(msg, state):
elif bool(text):
toxic_score = text2toxicity(text)
logger.info(f'\ntext: {text}\ntoxic: {math.floor(toxic_score*100)}%')
if toxic_score > 0.71:
toxic_reply = get_toxic_reply(toxic_score)
await telegram_api(