add davinci003

This commit is contained in:
Pavel_Duron 2023-02-06 21:54:41 +10:00
parent e619022112
commit b2d58f4320
2 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from handlers import davinci
from handlers import pipisa from handlers import pipisa
from handlers import time_new_year from handlers import time_new_year
from handlers import sendalarm from handlers import sendalarm

26
handlers/davinci.py Normal file
View File

@ -0,0 +1,26 @@
import openai
from aiogram import types, Dispatcher
from create_bot import dp, bot
token = '5947963644:AAF_GKgMmU5ovqMpc1KXIpcf4aN0JMyKPqc'
openai.api_key = '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'
@dp.message_handler()
async def send(message : types.Message):
if 'тупица' in message.text.lower():
response = openai.Completion.create(
model="text-davinci-003",
prompt=message.text[7:],
temperature=0.5,
max_tokens=1000,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.6,
stop=["You:"]
)
await message.reply(response['choices'][0]['text'])
else:
pass