This commit is contained in:
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.toxicity import text2toxicity
from nlp.replying import get_toxic_reply from nlp.replying import get_toxic_reply
import logging import logging
import math
from handlers.handle_private import handle_private from handlers.handle_private import handle_private
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -31,6 +32,7 @@ async def messages_routing(msg, state):
elif bool(text): elif bool(text):
toxic_score = text2toxicity(text) toxic_score = text2toxicity(text)
logger.info(f'\ntext: {text}\ntoxic: {math.floor(toxic_score*100)}%')
if toxic_score > 0.71: if toxic_score > 0.71:
toxic_reply = get_toxic_reply(toxic_score) toxic_reply = get_toxic_reply(toxic_score)
await telegram_api( await telegram_api(