🐛 fix(makeprompt.py): import Hasher class from src.utils.misc to resolve NameError

🔒 chore(makeprompt.py): add user hashing to prevent abuse and enable user banning if necessary
This commit is contained in:
2023-08-16 09:44:01 +02:00
parent a02bfb5cbc
commit ee825be892
2 changed files with 14 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ import datetime
import json
from src.config import curs_data, max_uses, curs_premium, gpt_3_5_turbo_prompt
from src.utils.misc import moderate, ModerationError
from src.utils.misc import moderate, ModerationError, Hasher
from src.utils.openaicaller import openai_caller
from src.functionscalls import (
call_function,
@@ -131,6 +131,7 @@ async def chatgpt_process(
messages=msgs,
functions=called_functions,
function_call="auto",
user=Hasher(str(message.author.id)), #for user banning in case of abuse
)
response = response["choices"][0]["message"] # type: ignore
if response.get("function_call"):